Minor vfork patch

David Marston david at illudium.org.uk
Thu Dec 4 13:41:06 PST 2003


It doesn't seem to be related to the current issue, but there's a patch
for vfork attached to fix the position of the child process pid stored
in the jmp_buf.

On a different subject I was looking at the other set/longjmp code. Can
anyone tell me if ___arm_alloca_longjmp and ___arm_alloca_setjmp in
gcc/libgcc/lib1aof.s are still needed. They don't appear to be called
anywhere anymore (since version 1.5 of gcc/gcc/config/arm/arm.h a year
ago) unless I'm missing something.

D
-- 
David Marston
david at illudium.org.uk
-------------- next part --------------
Index: unixlib/source/sys/_jmp.s
===================================================================
RCS file: /usr/local/cvsroot/gccsdk/unixlib/source/sys/_jmp.s,v
retrieving revision 1.8
diff -u -r1.8 _jmp.s
--- unixlib/source/sys/_jmp.s	23 Jun 2003 20:33:03 -0000	1.8
+++ unixlib/source/sys/_jmp.s	4 Dec 2003 21:34:03 -0000
@@ -32,6 +32,9 @@
 	;   + 100 ( 4) : lr
 	; = 104 bytes (= __JMP_BUF_SIZE * sizeof(int))
 
+	; NOTE: If the location of the child process in jmp_buf changes
+	; it must be updated in _vfork.s and vfork.c
+
 	EXPORT	setjmp
 	NAME	setjmp
 setjmp
Index: unixlib/source/sys/_vfork.s
===================================================================
RCS file: /usr/local/cvsroot/gccsdk/unixlib/source/sys/_vfork.s,v
retrieving revision 1.6
diff -u -r1.6 _vfork.s
--- unixlib/source/sys/_vfork.s	5 Apr 2003 12:16:34 -0000	1.6
+++ unixlib/source/sys/_vfork.s	4 Dec 2003 21:34:03 -0000
@@ -134,7 +134,8 @@
 	EXPORT	|__vret|
 |__vret|
 	BL	|__vexit|
-	LDR	a2, [a1, #52]
+	; The location of the child pid in jmp_buf
+	LDR	a2, [a1, #60]
 	B	longjmp
 
 	AREA	|C$$zidata|, DATA, NOINIT
Index: unixlib/source/sys/vfork.c
===================================================================
RCS file: /usr/local/cvsroot/gccsdk/unixlib/source/sys/vfork.c,v
retrieving revision 1.4
diff -u -r1.4 vfork.c
--- unixlib/source/sys/vfork.c	24 Sep 2002 21:02:38 -0000	1.4
+++ unixlib/source/sys/vfork.c	4 Dec 2003 21:34:05 -0000
@@ -248,7 +248,8 @@
 
   for (x = 0; x < __JMP_BUF_SIZE; x++)
     __u->child[0].vreg[x] = p->vreg[x];
-  __u->child[0].vreg[13] = p->pid;
+  /* Copy the pid of the old child process into the jmp_buf */
+  __u->child[0].vreg[15] = p->pid;
 
   /* Free memory allocated to the child process.  */
   free_process (p);


More information about the gcc mailing list