This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] vfork fixes


Hi!

This is what Richard was talking about on Alpha, happens on SPARC,
PPC32 as well. Tested (so far) on Alpha and PPC32 only.

2003-01-15  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/unix/sysv/linux/alpha/vfork.S (__vfork): Allow
	__fork to be far away from __vfork ifndef SHARED.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S (__vfork):
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S (__vfork): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S (__vfork): Likewise.
	Add a missing instruction.
	* sysdeps/unix/sysv/linux/arm/vfork.S (__vfork): Conditionally
	branch to __fork even if __NR_vfork is not defined.

--- libc/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S.jj	2003-01-09 21:27:54.000000000 +0100
+++ libc/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S	2003-01-14 16:09:43.000000000 +0100
@@ -23,7 +23,11 @@
 ENTRY(__vfork)
 	ld	[%g6 + MULTIPLE_THREADS_OFFSET], %o0
 	cmp	%o0, 0
+#ifdef SHARED
 	bne	HIDDEN_JUMPTARGET(__fork)
+#else
+	bne	1f
+#endif
 	 mov	__NR_vfork, %g1
 	ta 0x10;
 	bcs	__syscall_error_handler
@@ -31,6 +35,11 @@ ENTRY(__vfork)
 	sub	%o1, 1, %o1
 	retl
 	 and	%o0, %o1, %o0
+#ifndef SHARED
+1:	mov	%o7, %g1
+	call	HIDDEN_JUMPTARGET(__fork)
+	 mov	%g1, %o7
+#endif
 	SYSCALL_ERROR_HANDLER
 PSEUDO_END (__vfork)
 libc_hidden_def (__vfork)
--- libc/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S.jj	2003-01-09 21:28:07.000000000 +0100
+++ libc/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S	2003-01-14 16:15:13.000000000 +0100
@@ -22,7 +22,12 @@
 	.text
 ENTRY(__vfork)
 	ld	[%g6 + MULTIPLE_THREADS_OFFSET], %o0
+#ifdef SHARED
+	cmp	%o0, 0
 	bne	HIDDEN_JUMPTARGET (__fork)
+#else
+	brnz,pn	%o0, 1f
+#endif
 	 mov	__NR_vfork, %g1
 	ta	0x6d
 	bcs,pn	%xcc, __syscall_error_handler
@@ -30,6 +35,11 @@ ENTRY(__vfork)
 	sub	%o1, 1, %o1
 	retl
 	 and	%o0, %o1, %o0
+#ifndef SHARED
+1:	mov	%o7, %g1
+	call	HIDDEN_JUMPTARGET(__fork)
+	 mov	%g1, %o7
+#endif
 	SYSCALL_ERROR_HANDLER
 PSEUDO_END (__vfork)
 libc_hidden_def (__vfork)
--- libc/linuxthreads/sysdeps/unix/sysv/linux/alpha/vfork.S.jj	2003-01-09 21:28:32.000000000 +0100
+++ libc/linuxthreads/sysdeps/unix/sysv/linux/alpha/vfork.S	2003-01-14 17:09:25.000000000 +0100
@@ -27,11 +27,25 @@ __LABEL(__vfork)
 	.prologue 1
 	PSEUDO_PROF
 	SINGLE_THREAD_P(t0)
+#ifdef SHARED
 	bne	t0, HIDDEN_JUMPTARGET (__fork) !samegp
+#else
+	bne	t0, $hidden_fork
+#endif
 	lda	v0, SYS_ify(vfork)
 	call_pal PAL_callsys
+#ifdef SHARED
 	bne	a3, __syscall_error !samegp
+#else
+	bne	a3, $syscall_error
+#endif
 	ret
+#ifndef SHARED
+$hidden_fork:
+	jmp	zero, HIDDEN_JUMPTARGET (__fork)
+$syscall_error:
+	jmp	zero, __syscall_error
+#endif
 PSEUDO_END(__vfork)
 libc_hidden_def (__vfork)
 
--- libc/linuxthreads/sysdeps/unix/sysv/linux/arm/vfork.S.jj	2003-01-12 10:16:06.000000000 +0100
+++ libc/linuxthreads/sysdeps/unix/sysv/linux/arm/vfork.S	2003-01-14 17:02:54.000000000 +0100
@@ -32,9 +32,9 @@ rocess,
 
 ENTRY (__vfork)
 
-#ifdef __NR_vfork
 	SINGLE_THREAD_P
 	bne	HIDDEN_JUMPTARGET (__fork)
+#ifdef __NR_vfork
 	swi	__NR_vfork
 	cmn	a1, #4096
 	RETINSTR(movcc, pc, lr)
--- libc/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S.jj	2003-01-12 20:31:17.000000000 +0100
+++ libc/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S	2003-01-14 16:44:36.000000000 +0100
@@ -31,7 +31,11 @@ ENTRY (__vfork)
 #ifdef __NR_vfork
 
 	SINGLE_THREAD_P
+# ifdef SHARED
 	bne-	HIDDEN_JUMPTARGET(__fork)
+# else
+	bne-	.Lhidden_fork
+# endif
 
 	DO_CALL (SYS_ify (vfork));
 
@@ -41,7 +45,11 @@ ENTRY (__vfork)
 	bnslr+
 	/* Check if vfork syscall is known at all.  */
 	cmpwi	r3,ENOSYS
+#  ifdef SHARED
 	bne	JUMPTARGET(__syscall_error)
+#  else
+	bne	.Lsyscall_error
+#  endif
 
 # endif
 #endif
@@ -53,6 +61,13 @@ ENTRY (__vfork)
 	PSEUDO_RET
 #endif
 
+# ifndef SHARED
+.Lhidden_fork:
+	b	HIDDEN_JUMPTARGET(__fork)
+.Lsyscall_error:
+	b	JUMPTARGET(__syscall_error)
+# endif
+
 PSEUDO_END (__vfork)
 libc_hidden_def (__vfork)
 

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]