summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/i386/clone.S
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-07-07 23:30:36 +0000
committerMike Frysinger <vapier@gentoo.org>2005-07-07 23:30:36 +0000
commit94ba4f0d693305b3f290de1e5f2a0c961988fcc2 (patch)
treeceba21f3c1c618a74a62df1728a32b1c513488a1 /libc/sysdeps/linux/i386/clone.S
parentbddb15fad9923696cdab64e3cbafe00fee38cc29 (diff)
clean up from psm ... merge glibc updates and punt errno handling in favor of jockes trick of using __syscall_error
Diffstat (limited to 'libc/sysdeps/linux/i386/clone.S')
-rw-r--r--libc/sysdeps/linux/i386/clone.S59
1 files changed, 19 insertions, 40 deletions
diff --git a/libc/sysdeps/linux/i386/clone.S b/libc/sysdeps/linux/i386/clone.S
index de47ba31c..81c81a789 100644
--- a/libc/sysdeps/linux/i386/clone.S
+++ b/libc/sysdeps/linux/i386/clone.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996,1997,98,99,2000,02,03 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2000,02,03,04,2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@tamu.edu)
@@ -50,16 +50,26 @@ __clone:
/* no NULL function pointers */
movl FUNC(%esp),%ecx
- jecxz .Lclone_error
+#ifdef __PIC__
+ jecxz __error
+#else
+ testl %ecx,%ecx
+ jz __error
+#endif
/* no NULL stack pointers */
movl STACK(%esp),%ecx
- jecxz .Lclone_error
+#ifdef __PIC__
+ jecxz __error
+#else
+ testl %ecx,%ecx
+ jz __error
+#endif
/* Insert the argument onto the new stack. Make sure the new
thread is started with an alignment of (mod 16). */
andl $0xfffffff0, %ecx
- subl $24,%ecx
+ subl $28,%ecx
movl ARG(%esp),%eax /* no negative argument counts */
movl %eax,12(%ecx)
@@ -86,14 +96,13 @@ __clone:
popl %ebx
test %eax,%eax
- jl .Lclone_error
+ jl __error
jz .Lthread_start
-
-.Lpseudo_end:
ret
.Lthread_start:
- subl %ebp,%ebp /* terminate the stack frame */
+ /* Note: %esi is zero. */
+ movl %esi,%ebp /* terminate the stack frame */
call *%ebx
#ifdef __PIC__
call .Lhere
@@ -105,38 +114,8 @@ __clone:
movl $__NR_exit, %eax
int $0x80
-#ifdef __PIC__
-
-.Lthere:
- movl (%esp), %ebx
- ret
-
-.Lclone_error:
- pushl %ebx
- call .Lthere
- addl $_GLOBAL_OFFSET_TABLE_, %ebx
- xorl %edx, %edx
- subl %eax, %edx
- pushl %edx
- call __errno_location@PLT
- popl %ecx
- popl %ebx
- movl %ecx, (%eax)
- orl $-1, %eax
- jmp .Lpseudo_end
-
-#else /* __PIC__ */
-
-.Lclone_error:
- negl %eax
- pushl %eax
- call __errno_location
- popl %ecx
- movl %ecx, (%eax)
- xorl %eax, %eax
- decl %eax
-
-#endif
+__error:
+ call __syscall_error
.size __clone,.-__clone