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/mmap64.S | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) (limited to 'libc/sysdeps/linux/i386/mmap64.S') diff --git a/libc/sysdeps/linux/i386/mmap64.S b/libc/sysdeps/linux/i386/mmap64.S index 42d1bb69e..dde3b9ae1 100644 --- a/libc/sysdeps/linux/i386/mmap64.S +++ b/libc/sysdeps/linux/i386/mmap64.S @@ -65,6 +65,7 @@ mmap64: movl FD(%esp), %edi movl $__NR_mmap2, %eax /* System call number in %eax. */ + /* Do the system call trap. */ int $0x80 /* Restore registers. */ @@ -75,7 +76,8 @@ mmap64: /* If 0 > %eax > -4096 there was an error. */ cmpl $-4095,%eax - jae __syscall_error + ja __error + /* Successful; return the syscall's value. */ ret /* This means the offset value is too large. */ @@ -85,27 +87,11 @@ L_einval: popl %ebx popl %ebp movl $-EINVAL, %eax - jmp __syscall_error - - -__syscall_error: - negl %eax - pushl %eax -#ifdef __PIC__ - call .Lthere -.Lthere: - popl %ebx - addl $_GLOBAL_OFFSET_TABLE_+[.- .Lthere ], %ebx - call __errno_location@PLT -#else - call __errno_location -#endif - popl %ecx - movl %ecx, (%eax) - xorl %eax, %eax - decl %eax + jmp __error + +__error: + call __syscall_error -.Lsize: -.size mmap64,.Lsize-mmap64 +.size mmap64,.-mmap64 #endif -- cgit v1.2.3