bsd-_setjmp.S syscall.S mmap64.S
SOBJS=$(patsubst %.S,%.o, $(SSRC))
-CSRC=brk.c sigaction.c
+CSRC=brk.c sigaction.c __syscall_error.c
COBJS=$(patsubst %.c,%.o, $(CSRC))
OBJS=$(SOBJS) $(COBJS)
--- /dev/null
+/* Wrapper for setting errno.
+ Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <features.h>
+
+/* This routine is jumped to by all the syscall handlers, to stash
+ * an error number into errno. */
+int attribute_hidden __syscall_error(int err_no)
+{
+ __set_errno(err_no);
+ return -1;
+}
movl FD(%esp), %edi
movl $__NR_mmap2, %eax /* System call number in %eax. */
+ /* Do the system call trap. */
int $0x80
/* Restore registers. */
/* 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. */
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
* and things will just work.
*/
-#include <features.h>
-
.text
.global syscall
.type syscall,%function
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
int $0x80
pushl %ecx
cmpl $-4095,%eax
- jae __syscall_error
+ jae __error
ret
-__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
+__error:
+ call __syscall_error
-.Lsize:
-.size __vfork,.Lsize-__vfork
+.size __vfork,.-__vfork
.weak vfork ; vfork = __vfork