svn commit: branches/uClibc-nptl/libc/sysdeps/linux/arm

kraj at uclibc.org kraj at uclibc.org
Thu Jul 10 01:16:20 UTC 2008


Author: kraj
Date: 2008-07-09 18:16:18 -0700 (Wed, 09 Jul 2008)
New Revision: 22732

Log:
Save PID across vfork syscall. Create a __clone() aliased to clone(). Load arguments from stack into registers before making clone syscall

Modified:
   branches/uClibc-nptl/libc/sysdeps/linux/arm/clone.S
   branches/uClibc-nptl/libc/sysdeps/linux/arm/vfork.S


Changeset:
Modified: branches/uClibc-nptl/libc/sysdeps/linux/arm/clone.S
===================================================================
--- branches/uClibc-nptl/libc/sysdeps/linux/arm/clone.S	2008-07-10 01:09:10 UTC (rev 22731)
+++ branches/uClibc-nptl/libc/sysdeps/linux/arm/clone.S	2008-07-10 01:16:18 UTC (rev 22732)
@@ -30,12 +30,12 @@
 /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
 
 .text
-.global clone
-.type clone,%function
+.global __clone
+.type __clone,%function
 .align 2
 #if defined(THUMB1_ONLY)
 .thumb_func
-clone:
+__clone:
 	@ sanity check args
 	cmp	r0, #0
 	beq	__einval
@@ -52,9 +52,15 @@
 	@ get flags
 	mov	r0, r2
 	@ new sp is already in r1
+	@ load remaining arguments off the stack
+	stmfd	sp!, {r4}
+	ldr	r2, [sp, #4]
+	ldr	r3, [sp, #8]
+	ldr	r4, [sp, #12]
 	DO_CALL (clone)
 	movs	a1, a1
 	blt	__error
+	ldmnefd sp!, {r4}
 	beq	1f
 	bx	lr
 1:
@@ -80,7 +86,7 @@
 	POP_RET
 .pool
 #else
-clone:
+__clone:
 	@ sanity check args
 	cmp	r0, #0
 	IT(te, ne)
@@ -98,9 +104,15 @@
 	@ get flags
 	mov	r0, r2
 	@ new sp is already in r1
+	@ load remaining arguments off the stack
+	stmfd	sp!, {r4}
+	ldr	r2, [sp, #4]
+	ldr	r3, [sp, #8]
+	ldr	r4, [sp, #12]
 	DO_CALL (clone)
 	movs	a1, a1
 	blt	__error
+	ldmnefd	sp!, {r4}
 	IT(t, ne)
 #if defined(__USE_BX__)
 	bxne	lr
@@ -120,6 +132,7 @@
 	b	__syscall_error
 #endif
 
-.size clone,.-clone
+.size __clone,.-__clone
+weak_alias(__clone, clone)
 
 #endif

Modified: branches/uClibc-nptl/libc/sysdeps/linux/arm/vfork.S
===================================================================
--- branches/uClibc-nptl/libc/sysdeps/linux/arm/vfork.S	2008-07-10 01:09:10 UTC (rev 22731)
+++ branches/uClibc-nptl/libc/sysdeps/linux/arm/vfork.S	2008-07-10 01:16:18 UTC (rev 22732)
@@ -12,6 +12,15 @@
 #include <bits/errno.h>
 #include <sys/syscall.h>
 
+#ifndef SAVE_PID
+#define SAVE_PID
+#endif
+
+#ifndef RESTORE_PID
+#define RESTORE_PID
+#endif
+
+
 #ifdef __NR_fork
 .text
 .global	__vfork
@@ -23,7 +32,9 @@
 .thumb_func
 __vfork:
 #ifdef __NR_vfork
+	SAVE_PID
 	DO_CALL (vfork)
+	RESTORE_PID
 	ldr		r1, =0xfffff000
 	cmp		r0, r1
 	bcs		1f
@@ -57,7 +68,9 @@
 __vfork:
 
 #ifdef __NR_vfork
+	SAVE_PID
 	DO_CALL (vfork)
+	RESTORE_PID
 	cmn	r0, #4096
 	IT(t, cc)
 #if defined(__USE_BX__)




More information about the uClibc-cvs mailing list