From 94ba4f0d693305b3f290de1e5f2a0c961988fcc2 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Thu, 7 Jul 2005 23:30:36 +0000
Subject: clean up from psm ... merge glibc updates and punt errno handling in
 favor of jockes trick of using __syscall_error

---
 libc/sysdeps/linux/i386/clone.S | 59 +++++++++++++----------------------------
 1 file changed, 19 insertions(+), 40 deletions(-)

(limited to 'libc')

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
 
-- 
cgit v1.2.3