summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/i386/syscall.S
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-07-06 22:40:33 +0000
committerMike Frysinger <vapier@gentoo.org>2005-07-06 22:40:33 +0000
commit76d80593426f5f77a51dcf694786576a37f3b208 (patch)
tree9e70c2ade4627510fe6173ae614683efc28de466 /libc/sysdeps/linux/i386/syscall.S
parentd1de87b09ddd8f096d0191ffb0a694acea13d84b (diff)
Peter S. Mazinger writes: use the __syscall_error.c trick to handle setting errno
Diffstat (limited to 'libc/sysdeps/linux/i386/syscall.S')
-rw-r--r--libc/sysdeps/linux/i386/syscall.S55
1 files changed, 13 insertions, 42 deletions
diff --git a/libc/sysdeps/linux/i386/syscall.S b/libc/sysdeps/linux/i386/syscall.S
index b65950fb5..7c49625b2 100644
--- a/libc/sysdeps/linux/i386/syscall.S
+++ b/libc/sysdeps/linux/i386/syscall.S
@@ -20,8 +20,6 @@
* and things will just work.
*/
-#include <features.h>
-
.text
.global syscall
.type syscall,%function
@@ -30,49 +28,22 @@ syscall:
pushl %edi
pushl %esi
pushl %ebx
- movl 36(%esp),%edi; /* Load the 5 syscall argument registers */
- movl 32(%esp),%esi;
- movl 28(%esp),%edx;
- movl 24(%esp),%ecx;
- movl 20(%esp),%ebx;
+ movl 36(%esp),%edi /* Load the 5 syscall argument registers */
+ movl 32(%esp),%esi
+ movl 28(%esp),%edx
+ movl 24(%esp),%ecx
+ movl 20(%esp),%ebx
movl 16(%esp),%eax /* Load syscall number into %eax. */
-#APP
int $0x80
-#NO_APP
- cmpl $-4095,%eax
- jbe .Ldone
-
-#ifdef __PIC__
- call Lhere
-Lhere:
- popl %ebx
- addl $_GLOBAL_OFFSET_TABLE_+[.-Lhere],%ebx
- negl %eax
- movl %eax,%ecx
-#ifdef __UCLIBC_HAS_THREADS__
- call __errno_location@PLT
-#else
- movl errno@GOT(%ebx),%eax
-#endif /* __UCLIBC_HAS_THREADS__ */
- movl %ecx,(%eax)
-#else
- negl %eax
-#ifdef __UCLIBC_HAS_THREADS__
- movl %eax,%ecx
- call __errno_location
- movl %ecx,(%eax)
-#else
- movl %eax,errno
-#endif /* __UCLIBC_HAS_THREADS__ */
-
-#endif /* __PIC__ */
- movl $-1,%eax
- .p2align 4,,7
-.Ldone:
popl %ebx
popl %esi
popl %edi
- ret
-.Lsize:
-.size syscall,.Lsize-syscall
+ cmpl $-4095,%eax
+ jae __error
+ ret /* Return to caller. */
+
+__error:
+ call __syscall_error
+
+.size syscall,.-syscall