Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Fix PR9240: comment above cpu_fork() out of synch w...



details:   https://anonhg.NetBSD.org/src/rev/c55a36e22cd1
branches:  trunk
changeset: 480815:c55a36e22cd1
user:      sommerfeld <sommerfeld%NetBSD.org@localhost>
date:      Thu Jan 20 22:18:54 2000 +0000

description:
Fix PR9240: comment above cpu_fork() out of synch with reality on most ports.
(comment change only, but was wrong for more than just i386).

diffstat:

 sys/arch/alpha/alpha/vm_machdep.c     |  24 ++++++++++++++++--------
 sys/arch/amiga/amiga/vm_machdep.c     |  22 ++++++++++++++++------
 sys/arch/arm32/arm32/vm_machdep.c     |  22 +++++++++++++++-------
 sys/arch/atari/atari/vm_machdep.c     |  22 ++++++++++++++++------
 sys/arch/hp300/hp300/vm_machdep.c     |  22 +++++++++++++++-------
 sys/arch/i386/i386/vm_machdep.c       |  22 +++++++++++++++-------
 sys/arch/luna68k/luna68k/vm_machdep.c |  26 ++++++++++++++++++--------
 sys/arch/mac68k/mac68k/vm_machdep.c   |  22 ++++++++++++++++------
 sys/arch/mips/mips/vm_machdep.c       |  24 +++++++++++++++++-------
 sys/arch/mvme68k/mvme68k/vm_machdep.c |  22 ++++++++++++++++------
 sys/arch/news68k/news68k/vm_machdep.c |  22 +++++++++++++++-------
 sys/arch/next68k/next68k/vm_machdep.c |  22 +++++++++++++++-------
 sys/arch/pc532/pc532/vm_machdep.c     |  19 +++++++++++++++----
 sys/arch/powerpc/powerpc/vm_machdep.c |  16 +++++++++++++++-
 sys/arch/sh3/sh3/vm_machdep.c         |  22 +++++++++++++++-------
 sys/arch/sparc/sparc/vm_machdep.c     |  19 ++++++++++++++-----
 sys/arch/sparc64/sparc64/vm_machdep.c |  19 ++++++++++++++-----
 sys/arch/sun3/sun3/vm_machdep.c       |  22 ++++++++++++++++------
 sys/arch/vax/vax/vm_machdep.c         |  18 +++++++++++++++++-
 sys/arch/x68k/x68k/vm_machdep.c       |  22 ++++++++++++++++------
 20 files changed, 312 insertions(+), 117 deletions(-)

diffs (truncated from 732 to 300 lines):

diff -r 9974bf56e18e -r c55a36e22cd1 sys/arch/alpha/alpha/vm_machdep.c
--- a/sys/arch/alpha/alpha/vm_machdep.c Thu Jan 20 21:32:31 2000 +0000
+++ b/sys/arch/alpha/alpha/vm_machdep.c Thu Jan 20 22:18:54 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vm_machdep.c,v 1.52 1999/12/04 21:19:59 ragge Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.53 2000/01/20 22:18:54 sommerfeld Exp $ */
 
 /*
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -29,7 +29,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.52 1999/12/04 21:19:59 ragge Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.53 2000/01/20 22:18:54 sommerfeld Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -131,12 +131,20 @@
 
 /*
  * Finish a fork operation, with process p2 nearly set up.
- * Copy and update the kernel stack and pcb, making the child
- * ready to run, and marking it so that it can return differently
- * than the parent.  Returns 1 in the child process, 0 in the parent.
- * We currently double-map the user area so that the stack is at the same
- * address in each process; in the future we will probably relocate
- * the frame pointers on the stack after copying.
+ * Copy and update the pcb and trap frame, making the child ready to run.
+ * 
+ * Rig the child's kernel stack so that it will start out in
+ * switch_trampoline() and call child_return() with p2 as an
+ * argument. This causes the newly-created child process to go
+ * directly to user level with an apparent return value of 0 from
+ * fork(), while the parent process returns normally.
+ *
+ * p1 is the process being forked; if p1 == &proc0, we are creating
+ * a kernel thread, and the return path will later be changed in cpu_set_kpc.
+ *
+ * If an alternate user-level stack is requested (with non-zero values
+ * in both the stack and stacksize args), set up the user stack pointer
+ * accordingly.
  */
 void
 cpu_fork(p1, p2, stack, stacksize)
diff -r 9974bf56e18e -r c55a36e22cd1 sys/arch/amiga/amiga/vm_machdep.c
--- a/sys/arch/amiga/amiga/vm_machdep.c Thu Jan 20 21:32:31 2000 +0000
+++ b/sys/arch/amiga/amiga/vm_machdep.c Thu Jan 20 22:18:54 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.52 1999/12/04 21:20:03 ragge Exp $    */
+/*     $NetBSD: vm_machdep.c,v 1.53 2000/01/20 22:18:55 sommerfeld Exp $       */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -64,11 +64,21 @@
 #include <machine/pte.h>
 
 /*
- * Finish a fork operation, with process p2 nearly set up.  Copy and
- * update the kernel stack and pcb, making the child ready to run,  
- * and marking it so that it can return differently than the parent.
- * When scheduled, child p2 will start from proc_trampoline(). cpu_fork()
- * returns once for forking parent p1. 
+ * Finish a fork operation, with process p2 nearly set up.
+ * Copy and update the pcb and trap frame, making the child ready to run.
+ * 
+ * Rig the child's kernel stack so that it will start out in
+ * proc_trampoline() and call child_return() with p2 as an
+ * argument. This causes the newly-created child process to go
+ * directly to user level with an apparent return value of 0 from
+ * fork(), while the parent process returns normally.
+ *
+ * p1 is the process being forked; if p1 == &proc0, we are creating
+ * a kernel thread, and the return path will later be changed in cpu_set_kpc.
+ *
+ * If an alternate user-level stack is requested (with non-zero values
+ * in both the stack and stacksize args), set up the user stack pointer
+ * accordingly.
  */
 void
 cpu_fork(p1, p2, stack, stacksize)
diff -r 9974bf56e18e -r c55a36e22cd1 sys/arch/arm32/arm32/vm_machdep.c
--- a/sys/arch/arm32/arm32/vm_machdep.c Thu Jan 20 21:32:31 2000 +0000
+++ b/sys/arch/arm32/arm32/vm_machdep.c Thu Jan 20 22:18:54 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.47 1999/12/04 21:20:09 ragge Exp $    */
+/*     $NetBSD: vm_machdep.c,v 1.48 2000/01/20 22:18:55 sommerfeld Exp $       */
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -96,12 +96,20 @@
 
 /*
  * Finish a fork operation, with process p2 nearly set up.
- * Copy and update the kernel stack and pcb, making the child
- * ready to run, and marking it so that it can return differently
- * than the parent.  Returns 1 in the child process, 0 in the parent.
- * We currently double-map the user area so that the stack is at the same
- * address in each process; in the future we will probably relocate
- * the frame pointers on the stack after copying.
+ * Copy and update the pcb and trap frame, making the child ready to run.
+ * 
+ * Rig the child's kernel stack so that it will start out in
+ * proc_trampoline() and call child_return() with p2 as an
+ * argument. This causes the newly-created child process to go
+ * directly to user level with an apparent return value of 0 from
+ * fork(), while the parent process returns normally.
+ *
+ * p1 is the process being forked; if p1 == &proc0, we are creating
+ * a kernel thread, and the return path will later be changed in cpu_set_kpc.
+ *
+ * If an alternate user-level stack is requested (with non-zero values
+ * in both the stack and stacksize args), set up the user stack pointer
+ * accordingly.
  */
 
 void
diff -r 9974bf56e18e -r c55a36e22cd1 sys/arch/atari/atari/vm_machdep.c
--- a/sys/arch/atari/atari/vm_machdep.c Thu Jan 20 21:32:31 2000 +0000
+++ b/sys/arch/atari/atari/vm_machdep.c Thu Jan 20 22:18:54 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.30 1999/12/04 21:20:15 ragge Exp $    */
+/*     $NetBSD: vm_machdep.c,v 1.31 2000/01/20 22:18:55 sommerfeld Exp $       */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -64,11 +64,21 @@
 #include <machine/cpu.h>
 
 /*
- * Finish a fork operation, with process p2 nearly set up.  Copy and
- * update the kernel stack and pcb, making the child ready to run,  
- * and marking it so that it can return differently than the parent.
- * When scheduled, child p2 will start from proc_trampoline(). cpu_fork()
- * returns once for forking parent p1. 
+ * Finish a fork operation, with process p2 nearly set up.
+ * Copy and update the pcb and trap frame, making the child ready to run.
+ * 
+ * Rig the child's kernel stack so that it will start out in
+ * proc_trampoline() and call child_return() with p2 as an
+ * argument. This causes the newly-created child process to go
+ * directly to user level with an apparent return value of 0 from
+ * fork(), while the parent process returns normally.
+ *
+ * p1 is the process being forked; if p1 == &proc0, we are creating
+ * a kernel thread, and the return path will later be changed in cpu_set_kpc.
+ *
+ * If an alternate user-level stack is requested (with non-zero values
+ * in both the stack and stacksize args), set up the user stack pointer
+ * accordingly.
  */
 void
 cpu_fork(p1, p2, stack, stacksize)
diff -r 9974bf56e18e -r c55a36e22cd1 sys/arch/hp300/hp300/vm_machdep.c
--- a/sys/arch/hp300/hp300/vm_machdep.c Thu Jan 20 21:32:31 2000 +0000
+++ b/sys/arch/hp300/hp300/vm_machdep.c Thu Jan 20 22:18:54 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.53 1999/12/04 21:20:24 ragge Exp $    */
+/*     $NetBSD: vm_machdep.c,v 1.54 2000/01/20 22:18:56 sommerfeld Exp $       */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -64,12 +64,20 @@
 
 /*
  * Finish a fork operation, with process p2 nearly set up.
- * Copy and update the kernel stack and pcb, making the child
- * ready to run, and marking it so that it can return differently
- * than the parent.  Returns 1 in the child process, 0 in the parent.
- * We currently double-map the user area so that the stack is at the same
- * address in each process; in the future we will probably relocate
- * the frame pointers on the stack after copying.
+ * Copy and update the pcb and trap frame, making the child ready to run.
+ * 
+ * Rig the child's kernel stack so that it will start out in
+ * proc_trampoline() and call child_return() with p2 as an
+ * argument. This causes the newly-created child process to go
+ * directly to user level with an apparent return value of 0 from
+ * fork(), while the parent process returns normally.
+ *
+ * p1 is the process being forked; if p1 == &proc0, we are creating
+ * a kernel thread, and the return path will later be changed in cpu_set_kpc.
+ *
+ * If an alternate user-level stack is requested (with non-zero values
+ * in both the stack and stacksize args), set up the user stack pointer
+ * accordingly.
  */
 void
 cpu_fork(p1, p2, stack, stacksize)
diff -r 9974bf56e18e -r c55a36e22cd1 sys/arch/i386/i386/vm_machdep.c
--- a/sys/arch/i386/i386/vm_machdep.c   Thu Jan 20 21:32:31 2000 +0000
+++ b/sys/arch/i386/i386/vm_machdep.c   Thu Jan 20 22:18:54 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.85 1999/12/04 21:20:33 ragge Exp $    */
+/*     $NetBSD: vm_machdep.c,v 1.86 2000/01/20 22:18:56 sommerfeld Exp $       */
 
 /*-
  * Copyright (c) 1995 Charles M. Hannum.  All rights reserved.
@@ -77,12 +77,20 @@
 
 /*
  * Finish a fork operation, with process p2 nearly set up.
- * Copy and update the kernel stack and pcb, making the child
- * ready to run, and marking it so that it can return differently
- * than the parent.  Returns 1 in the child process, 0 in the parent.
- * We currently double-map the user area so that the stack is at the same
- * address in each process; in the future we will probably relocate
- * the frame pointers on the stack after copying.
+ * Copy and update the pcb and trap frame, making the child ready to run.
+ * 
+ * Rig the child's kernel stack so that it will start out in
+ * proc_trampoline() and call child_return() with p2 as an
+ * argument. This causes the newly-created child process to go
+ * directly to user level with an apparent return value of 0 from
+ * fork(), while the parent process returns normally.
+ *
+ * p1 is the process being forked; if p1 == &proc0, we are creating
+ * a kernel thread, and the return path will later be changed in cpu_set_kpc.
+ *
+ * If an alternate user-level stack is requested (with non-zero values
+ * in both the stack and stacksize args), set up the user stack pointer
+ * accordingly.
  */
 void
 cpu_fork(p1, p2, stack, stacksize)
diff -r 9974bf56e18e -r c55a36e22cd1 sys/arch/luna68k/luna68k/vm_machdep.c
--- a/sys/arch/luna68k/luna68k/vm_machdep.c     Thu Jan 20 21:32:31 2000 +0000
+++ b/sys/arch/luna68k/luna68k/vm_machdep.c     Thu Jan 20 22:18:54 2000 +0000
@@ -1,5 +1,5 @@
-/* $NetBSD: vm_machdep.c,v 1.1 2000/01/05 08:49:04 nisimura Exp $ */
-/*     $NetBSD: vm_machdep.c,v 1.1 2000/01/05 08:49:04 nisimura Exp $  */
+/* $NetBSD: vm_machdep.c,v 1.2 2000/01/20 22:18:56 sommerfeld Exp $ */
+/*     $NetBSD: vm_machdep.c,v 1.2 2000/01/20 22:18:56 sommerfeld Exp $        */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -44,7 +44,7 @@
  */
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.1 2000/01/05 08:49:04 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.2 2000/01/20 22:18:56 sommerfeld Exp $");
 
 #include "opt_compat_hpux.h"
 
@@ -69,11 +69,21 @@
 #include <m68k/cacheops.h>
 
 /*
- * Finish a fork operation, with process p2 nearly set up.  Copy and
- * update the kernel stack and pcb, making the child ready to run,  
- * and marking it so that it can return differently than the parent.
- * When scheduled, child p2 will start from proc_trampoline(). cpu_fork()
- * returns once for forking parent p1. 
+ * Finish a fork operation, with process p2 nearly set up.
+ * Copy and update the pcb and trap frame, making the child ready to run.
+ * 
+ * Rig the child's kernel stack so that it will start out in
+ * proc_trampoline() and call child_return() with p2 as an
+ * argument. This causes the newly-created child process to go
+ * directly to user level with an apparent return value of 0 from
+ * fork(), while the parent process returns normally.
+ *
+ * p1 is the process being forked; if p1 == &proc0, we are creating
+ * a kernel thread, and the return path will later be changed in cpu_set_kpc.
+ *
+ * If an alternate user-level stack is requested (with non-zero values
+ * in both the stack and stacksize args), set up the user stack pointer
+ * accordingly.
  */
 void
 cpu_fork(p1, p2, stack, stacksize)
diff -r 9974bf56e18e -r c55a36e22cd1 sys/arch/mac68k/mac68k/vm_machdep.c
--- a/sys/arch/mac68k/mac68k/vm_machdep.c       Thu Jan 20 21:32:31 2000 +0000
+++ b/sys/arch/mac68k/mac68k/vm_machdep.c       Thu Jan 20 22:18:54 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.44 1999/12/04 21:20:45 ragge Exp $    */
+/*     $NetBSD: vm_machdep.c,v 1.45 2000/01/20 22:18:57 sommerfeld Exp $       */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -63,11 +63,21 @@
 #include <uvm/uvm_extern.h>
 
 /*
- * Finish a fork operation, with process p2 nearly set up.  Copy and
- * update the kernel stack and pcb, making the child ready to run,  
- * and marking it so that it can return differently than the parent.
- * When scheduled, child p2 will start from proc_trampoline(). cpu_fork()
- * returns once for forking parent p1. 
+ * Finish a fork operation, with process p2 nearly set up.
+ * Copy and update the pcb and trap frame, making the child ready to run.
+ * 
+ * Rig the child's kernel stack so that it will start out in
+ * proc_trampoline() and call child_return() with p2 as an
+ * argument. This causes the newly-created child process to go
+ * directly to user level with an apparent return value of 0 from
+ * fork(), while the parent process returns normally.
+ *
+ * p1 is the process being forked; if p1 == &proc0, we are creating



Home | Main Index | Thread Index | Old Index