From 76d80593426f5f77a51dcf694786576a37f3b208 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 6 Jul 2005 22:40:33 +0000 Subject: Peter S. Mazinger writes: use the __syscall_error.c trick to handle setting errno --- libc/sysdeps/linux/i386/syscall.S | 55 +++++++++------------------------------ 1 file changed, 13 insertions(+), 42 deletions(-) (limited to 'libc/sysdeps/linux/i386/syscall.S') 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 - .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 -- cgit v1.2.3