summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/arm/mmap.S
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-04-14 13:42:55 +0000
committerUlrich Drepper <drepper@redhat.com>1999-04-14 13:42:55 +0000
commit9b2446e825d9c998b270a1dcca1dfd3262e487e0 (patch)
treee34382ebd0c2c1c72f680b598c129876f8cd4868 /sysdeps/unix/sysv/linux/arm/mmap.S
parent1156499baede7abd7ccf1b3b9fb3c587c941b915 (diff)
downloadglibc-9b2446e825d9c998b270a1dcca1dfd3262e487e0.tar.gz
Update.
1999-04-14 Scott Bambrough <scottb@netwinder.org> * sysdeps/unix/sysv/linux/arm/socket.S: Socket calls could not be restarted after being interrupted by a signal. The parameters on the stack were corrupted by the signal handler. * sysdeps/unix/sysv/linux/arm/mmap.S: mmap calls could not be restarted after being interrupted by a signal. The parameters on the stack were corrupted by the signal handler.
Diffstat (limited to 'sysdeps/unix/sysv/linux/arm/mmap.S')
-rw-r--r--sysdeps/unix/sysv/linux/arm/mmap.S22
1 files changed, 19 insertions, 3 deletions
diff --git a/sysdeps/unix/sysv/linux/arm/mmap.S b/sysdeps/unix/sysv/linux/arm/mmap.S
index f9a773fc68..fcff57c55d 100644
--- a/sysdeps/unix/sysv/linux/arm/mmap.S
+++ b/sysdeps/unix/sysv/linux/arm/mmap.S
@@ -26,10 +26,26 @@ ENTRY (__mmap)
mmap() takes six, we need to build a parameter block and pass its
address instead. The 386 port does a similar trick. */
- mov ip, sp
- stmdb ip!, {a1-a4}
- mov a1, ip
+ /* This code previously moved sp into ip and stored the args using
+ stmdb ip!, {a1-a4}. It did not modify sp, so the stack never had
+ to be restored after the syscall completed. It saved an
+ instruction and meant no stack cleanup work was required.
+
+ This will not work in the case of a mmap call being interrupted
+ by a signal. If the signal handler uses any stack the arguments
+ to mmap will be trashed. The results of a restart of mmap are
+ then unpredictable. */
+
+ /* store args on the stack */
+ stmdb sp!, {a1-a4}
+
+ /* do the syscall */
+ mov a1, sp
swi SYS_ify (mmap)
+
+ /* pop args off the stack. */
+ add sp, sp, #16
+
cmn r0, $4096
bhs PLTJMP(syscall_error);
ret