[parisc-linux-cvs] linux-2.5 tausq

Randolph Chung Randolph Chung <randolph@tausq.org>
Thu, 31 Oct 2002 22:50:55 -0800


> correctly return the pid when calling do_fork from __kernel_thread
> zero out the user_tid field when calling do_fork

do_fork used to return the pid, now it returns a task_struct so we need
to lookup the pid...

also do_fork takes a 5th argument now (user_tid). it's not used in this
case, but we zero it out to be thorough....

Index: arch/parisc/kernel/entry.S
===================================================================
RCS file: /var/cvs/linux-2.5/arch/parisc/kernel/entry.S,v
retrieving revision 1.24
diff -u -p -r1.24 entry.S
--- arch/parisc/kernel/entry.S	31 Oct 2002 23:29:25 -0000	1.24
+++ arch/parisc/kernel/entry.S	1 Nov 2002 06:42:27 -0000
@@ -527,23 +527,28 @@ __kernel_thread:
 	ldd	24(%r26), %r2
 	STREG	%r2, PT_GR27(%r1)	/* Store childs %dp */
 	ldd	16(%r26), %r26
+
+	STREG	%r22, PT_GR22(%r1)	/* Store childs %dp */
+	copy	%r0, %r22		/* user_tid */
 #endif
 	STREG	%r26, PT_GR26(%r1)  /* Store function & argument for child */
 	STREG	%r25, PT_GR25(%r1)
 	ldo	CLONE_VM(%r0), %r26   /* Force CLONE_VM since only init_mm */
 	or	%r26, %r24, %r26      /* will have kernel mappings.	 */
-	copy	%r0, %r25
+	copy	%r0, %r25		/* stack_start */
+	stw	%r0, -52(%r30)	     	/* user_tid */
 #ifdef __LP64__
 	ldo	-16(%r30),%r29		/* Reference param save area */
 #endif
 	bl	do_fork, %r2
-	copy	%r1, %r24
+	copy	%r1, %r24		/* pt_regs */
 
 	/* Parent Returns here */
 
 	LDREG	-PT_SZ_ALGN-RP_OFFSET(%r30), %r2
-	bv	%r0(%r2)
 	ldo	-PT_SZ_ALGN(%r30), %r30
+	bv	%r0(%r2)
+	ldw	TASK_PID(%r28), %r28
 
 	/*
 	 * Child Returns here
@@ -565,6 +570,7 @@ ret_from_kernel_thread:
 	LDREG	TASK_PT_GR25(%r1), %r26
 #ifdef __LP64__
 	LDREG	TASK_PT_GR27(%r1), %r27
+	LDREG	TASK_PT_GR22(%r1), %r22
 #endif
 	LDREG	TASK_PT_GR26(%r1), %r1
 	ble	0(%sr7, %r1)

-- 
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/