Browse Source

Fix clone so it compiles
-Erik

Eric Andersen 22 years ago
parent
commit
a0446356a9
2 changed files with 20 additions and 8 deletions
  1. 1 1
      libc/sysdeps/linux/mips/Makefile
  2. 19 7
      libc/sysdeps/linux/mips/clone.S

+ 1 - 1
libc/sysdeps/linux/mips/Makefile

@@ -30,7 +30,7 @@ TARGET_MACHINE_TYPE=$(shell $(CC) -dumpmachine)
 CRT0=crt0.S
 CRT0=crt0.S
 CRT0_OBJ=$(patsubst %.S,%.o, $(CRT0))
 CRT0_OBJ=$(patsubst %.S,%.o, $(CRT0))
 
 
-SSRC=bsd-_setjmp.S bsd-setjmp.S setjmp.S #fork.S clone.S
+SSRC=bsd-_setjmp.S bsd-setjmp.S setjmp.S clone.S #fork.S
 SOBJS=$(patsubst %.S,%.o, $(SSRC))
 SOBJS=$(patsubst %.S,%.o, $(SSRC))
 
 
 CSRC=__longjmp.c  brk.c vfork.c setjmp_aux.c _mmap.c pipe.c
 CSRC=__longjmp.c  brk.c vfork.c setjmp_aux.c _mmap.c pipe.c

+ 19 - 7
libc/sysdeps/linux/mips/clone.S

@@ -21,14 +21,21 @@
    and invokes a function in the right context after its all over.  */
    and invokes a function in the right context after its all over.  */
 
 
 #include <asm/unistd.h>
 #include <asm/unistd.h>
-#include <sysdep.h>
+#include <sys/regdef.h>
 #define _ERRNO_H	1
 #define _ERRNO_H	1
 #include <bits/errno.h>
 #include <bits/errno.h>
+#include <asm/asm.h>
 
 
 /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */
 /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */
 
 
 	.text
 	.text
-NESTED(__clone,4*SZREG,sp)
+.globl   __clone ;
+	.align       2;
+	.type         __clone,@function;
+	.ent        __clone, 0;
+	
+__clone:
+	.frame	    sp, 4*SZREG, sp
 #ifdef __PIC__
 #ifdef __PIC__
 	.set		noreorder
 	.set		noreorder
 	.cpload		$25
 	.cpload		$25
@@ -66,7 +73,7 @@ NESTED(__clone,4*SZREG,sp)
 
 
 	/* Successful return from the parent */
 	/* Successful return from the parent */
 	addiu		sp,32
 	addiu		sp,32
-	ret
+	j $31  ; nop
 
 
 	/* Something bad happened -- no child created */
 	/* Something bad happened -- no child created */
 error:
 error:
@@ -77,13 +84,17 @@ error:
 #else
 #else
 	j		__syscall_error
 	j		__syscall_error
 #endif
 #endif
-	END(__clone)
+	.end  __clone
 
 
 /* Load up the arguments to the function.  Put this block of code in
 /* Load up the arguments to the function.  Put this block of code in
    its own function so that we can terminate the stack trace with our
    its own function so that we can terminate the stack trace with our
    debug info.  */
    debug info.  */
 
 
-ENTRY(__thread_start)
+.globl  __thread_start;
+	.align 2;
+	.ent  __thread_start, 0;
+
+__thread_start:
 	/* cp is already loaded.  */
 	/* cp is already loaded.  */
 	.cprestore	16
 	.cprestore	16
 	/* The stackframe has been created on entry of clone().  */
 	/* The stackframe has been created on entry of clone().  */
@@ -102,6 +113,7 @@ ENTRY(__thread_start)
 #else
 #else
 	jal		_exit
 	jal		_exit
 #endif
 #endif
-	END(__thread_start)
+	.end  __thread_start
 
 
-weak_alias(__clone, clone)
+.weak clone;
+	clone = __clone