patch-2.4.0-test11 linux/arch/sparc64/kernel/process.c
Next file: linux/arch/sparc64/kernel/semaphore.c
Previous file: linux/arch/sparc64/kernel/pci.c
Back to the patch index
Back to the overall index
- Lines: 40
- Date:
Thu Nov 9 15:57:41 2000
- Orig file:
v2.4.0-test10/linux/arch/sparc64/kernel/process.c
- Orig date:
Thu Sep 7 08:32:00 2000
diff -u --recursive --new-file v2.4.0-test10/linux/arch/sparc64/kernel/process.c linux/arch/sparc64/kernel/process.c
@@ -1,4 +1,4 @@
-/* $Id: process.c,v 1.112 2000/09/06 00:45:01 davem Exp $
+/* $Id: process.c,v 1.113 2000/11/08 08:14:58 davem Exp $
* arch/sparc64/kernel/process.c
*
* Copyright (C) 1995, 1996 David S. Miller (davem@caip.rutgers.edu)
@@ -647,14 +647,21 @@
{
long retval;
- __asm__ __volatile("mov %1, %%g1\n\t"
+ /* If the parent runs before fn(arg) is called by the child,
+ * the input registers of this function can be clobbered.
+ * So we stash 'fn' and 'arg' into global registers which
+ * will not be modified by the parent.
+ */
+ __asm__ __volatile("mov %4, %%g2\n\t" /* Save FN into global */
+ "mov %5, %%g3\n\t" /* Save ARG into global */
+ "mov %1, %%g1\n\t" /* Clone syscall nr. */
"mov %2, %%o0\n\t" /* Clone flags. */
"mov 0, %%o1\n\t" /* usp arg == 0 */
"t 0x6d\n\t" /* Linux/Sparc clone(). */
"brz,a,pn %%o1, 1f\n\t" /* Parent, just return. */
" mov %%o0, %0\n\t"
- "jmpl %4, %%o7\n\t" /* Call the function. */
- " mov %5, %%o0\n\t" /* Set arg in delay. */
+ "jmpl %%g2, %%o7\n\t" /* Call the function. */
+ " mov %%g3, %%o0\n\t" /* Set arg in delay. */
"mov %3, %%g1\n\t"
"t 0x6d\n\t" /* Linux/Sparc exit(). */
/* Notreached by child. */
@@ -662,7 +669,7 @@
"=r" (retval) :
"i" (__NR_clone), "r" (flags | CLONE_VM),
"i" (__NR_exit), "r" (fn), "r" (arg) :
- "g1", "o0", "o1", "memory", "cc");
+ "g1", "g2", "g3", "o0", "o1", "memory", "cc");
return retval;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)