From 4a2b9d7463ce729071f4143a81569976dc7ad6b0 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Sat, 3 Jan 2004 05:52:34 +0000 Subject: Minor changes --- libc/sysdeps/linux/i386/clone.S | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) (limited to 'libc/sysdeps/linux/i386/clone.S') diff --git a/libc/sysdeps/linux/i386/clone.S b/libc/sysdeps/linux/i386/clone.S index d18d4edc2..d918fc444 100644 --- a/libc/sysdeps/linux/i386/clone.S +++ b/libc/sysdeps/linux/i386/clone.S @@ -24,6 +24,7 @@ */ #define _ERRNO_H 1 +#include #include #include @@ -39,31 +40,42 @@ #define CTID TLS+PTR_SIZE - .text - .globl __clone; - .type __clone,@function; - .align 1<<4; +.text +.type clone,@function; +.weak clone ; clone = __clone + +.type __clone,@function; +.globl __clone; __clone: /* Sanity check arguments. */ movl $-EINVAL,%eax + + test %ecx,%ecx + call .Lclone_error + + test %edx,%edx + call .Lclone_error + movl FUNC(%esp),%ecx /* no NULL function pointers */ #ifdef __PIC__ - jecxz __syscall_error + jecxz .Lclone_error #else testl %ecx,%ecx - jz __syscall_error + jz .Lclone_error #endif movl STACK(%esp),%ecx /* no NULL stack pointers */ #ifdef __PIC__ - jecxz __syscall_error + jecxz .Lclone_error #else testl %ecx,%ecx - jz __syscall_error + jz .Lclone_error #endif - /* Insert the argument onto the new stack. */ - subl $16,%ecx + /* 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 movl ARG(%esp),%eax /* no negative argument counts */ movl %eax,12(%ecx) @@ -90,7 +102,7 @@ __clone: popl %ebx test %eax,%eax - jl __syscall_error + jl .Lclone_error jz .Lthread_start .Lpseudo_end: @@ -109,7 +121,7 @@ __clone: movl $__NR_exit, %eax int $0x80 -__syscall_error: +.Lclone_error: negl %eax pushl %eax #ifdef __PIC__ @@ -129,4 +141,3 @@ __syscall_error: .Lsize: .size __clone,.Lsize-__clone -.weak clone ; clone = __clone -- cgit v1.2.3