Source-Changes-HG archive

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

[src/trunk]: src/sys/arch - Adjust descriptive comment of cpu_fork() which re...



details:   https://anonhg.NetBSD.org/src/rev/15e5ed11a225
branches:  trunk
changeset: 472957:15e5ed11a225
user:      nisimura <nisimura%NetBSD.org@localhost>
date:      Fri May 14 02:11:59 1999 +0000

description:
- Adjust descriptive comment of cpu_fork() which returns nothing and
returns once.
- Minor fixes in mips/vm_machdep.c.

diffstat:

 sys/arch/amiga/amiga/vm_machdep.c     |  14 ++++++--------
 sys/arch/atari/atari/vm_machdep.c     |  14 ++++++--------
 sys/arch/mac68k/mac68k/vm_machdep.c   |  14 ++++++--------
 sys/arch/mips/mips/vm_machdep.c       |  34 ++++++++++++++++++----------------
 sys/arch/mvme68k/mvme68k/vm_machdep.c |  14 ++++++--------
 sys/arch/sun3/sun3/vm_machdep.c       |  11 ++++++-----
 sys/arch/x68k/x68k/vm_machdep.c       |  14 ++++++--------
 7 files changed, 54 insertions(+), 61 deletions(-)

diffs (254 lines):

diff -r 1f6ce8aa2114 -r 15e5ed11a225 sys/arch/amiga/amiga/vm_machdep.c
--- a/sys/arch/amiga/amiga/vm_machdep.c Fri May 14 00:18:51 1999 +0000
+++ b/sys/arch/amiga/amiga/vm_machdep.c Fri May 14 02:11:59 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.43 1999/05/13 21:58:33 thorpej Exp $  */
+/*     $NetBSD: vm_machdep.c,v 1.44 1999/05/14 02:11:59 nisimura Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -63,13 +63,11 @@
 #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.  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.
+ * 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. 
  */
 void
 cpu_fork(p1, p2, stack, stacksize)
diff -r 1f6ce8aa2114 -r 15e5ed11a225 sys/arch/atari/atari/vm_machdep.c
--- a/sys/arch/atari/atari/vm_machdep.c Fri May 14 00:18:51 1999 +0000
+++ b/sys/arch/atari/atari/vm_machdep.c Fri May 14 02:11:59 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.24 1999/05/13 21:58:33 thorpej Exp $  */
+/*     $NetBSD: vm_machdep.c,v 1.25 1999/05/14 02:11:59 nisimura Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -64,13 +64,11 @@
 #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.  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.
+ * 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. 
  */
 void
 cpu_fork(p1, p2, stack, stacksize)
diff -r 1f6ce8aa2114 -r 15e5ed11a225 sys/arch/mac68k/mac68k/vm_machdep.c
--- a/sys/arch/mac68k/mac68k/vm_machdep.c       Fri May 14 00:18:51 1999 +0000
+++ b/sys/arch/mac68k/mac68k/vm_machdep.c       Fri May 14 02:11:59 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.37 1999/05/13 21:58:34 thorpej Exp $  */
+/*     $NetBSD: vm_machdep.c,v 1.38 1999/05/14 02:12:00 nisimura Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -63,13 +63,11 @@
 #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.  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.
+ * 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. 
  */
 void
 cpu_fork(p1, p2, stack, stacksize)
diff -r 1f6ce8aa2114 -r 15e5ed11a225 sys/arch/mips/mips/vm_machdep.c
--- a/sys/arch/mips/mips/vm_machdep.c   Fri May 14 00:18:51 1999 +0000
+++ b/sys/arch/mips/mips/vm_machdep.c   Fri May 14 02:11:59 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.36 1999/05/13 21:58:34 thorpej Exp $  */
+/*     $NetBSD: vm_machdep.c,v 1.37 1999/05/14 02:12:00 nisimura Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.36 1999/05/13 21:58:34 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.37 1999/05/14 02:12:00 nisimura Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -61,6 +61,7 @@
 
 #include <uvm/uvm_extern.h>
 
+#include <mips/regnum.h>
 #include <mips/locore.h>
 #include <mips/pte.h>
 #include <machine/cpu.h>
@@ -71,7 +72,11 @@
 extern paddr_t kvtophys __P((vaddr_t));        /* XXX */
 
 /*
- * cpu_fork() now returns just once.
+ * 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.
  */
 void
 cpu_fork(p1, p2, stack, stacksize)
@@ -90,8 +95,6 @@
                mips3_HitFlushDCache((vaddr_t)p2->p_addr, USPACE);
 #endif
 
-       if (p1 == fpcurproc)
-               savefpregs(p1);
 
 #ifdef DIAGNOSTIC
        /*
@@ -100,20 +103,18 @@
        if (p1 != curproc && p1 != &proc0)
                panic("cpu_fork: curproc");
 #endif
-
-       /* Copy pcb from proc p1 to p2. */
-       p2->p_addr->u_pcb = p1->p_addr->u_pcb;
+       if (p1 == fpcurproc)
+               savefpregs(p1);
 
        /*
-        * Create the child's kernel stack, from scratch.
-        * Pick a stack pointer, leaving room for a trapframe;
-        * copy trapframe from parent so return to user mode
+        * Copy pcb from proc p1 to p2.
+        * Copy p1 trapframe atop on p2 stack space, so return to user mode
         * will be to right address, with correct registers.
         */
-       pcb = &p2->p_addr->u_pcb;
-       f = (struct frame *)((int)pcb + USPACE) - 1;
+       memcpy(&p2->p_addr->u_pcb, &p1->p_addr->u_pcb, sizeof(struct pcb));
+       f = (struct frame *)((caddr_t)p2->p_addr + USPACE) - 1;
        memcpy(f, p1->p_md.md_regs, sizeof(struct frame));
-       memset(((caddr_t) f) - 24, 0, 24);
+       memset((caddr_t)f - 24, 0, 24);         /* ? required ? */
 
        /*
         * If specified, give the child a different stack.
@@ -129,9 +130,10 @@
                p2->p_md.md_upte[i] = pte[i].pt_entry &~ x;
 
        /*
-        * Arrange for continuation at child_return(), which
-        * will return to user process soon.
+        * Arrange for continuation at child_return(), which will return to
+        * user process soon.
         */
+       pcb = &p2->p_addr->u_pcb;
        pcb->pcb_segtab = (void *)p2->p_vmspace->vm_map.pmap->pm_segtab;
        pcb->pcb_context[10] = (int)proc_trampoline;    /* RA */
        pcb->pcb_context[8] = (int)f - 24;              /* SP */
diff -r 1f6ce8aa2114 -r 15e5ed11a225 sys/arch/mvme68k/mvme68k/vm_machdep.c
--- a/sys/arch/mvme68k/mvme68k/vm_machdep.c     Fri May 14 00:18:51 1999 +0000
+++ b/sys/arch/mvme68k/mvme68k/vm_machdep.c     Fri May 14 02:11:59 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.21 1999/05/13 21:58:34 thorpej Exp $  */
+/*     $NetBSD: vm_machdep.c,v 1.22 1999/05/14 02:12:00 nisimura Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -65,13 +65,11 @@
 #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.  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.
+ * 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. 
  */
 void
 cpu_fork(p1, p2, stack, stacksize)
diff -r 1f6ce8aa2114 -r 15e5ed11a225 sys/arch/sun3/sun3/vm_machdep.c
--- a/sys/arch/sun3/sun3/vm_machdep.c   Fri May 14 00:18:51 1999 +0000
+++ b/sys/arch/sun3/sun3/vm_machdep.c   Fri May 14 02:11:59 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.50 1999/05/13 21:58:36 thorpej Exp $  */
+/*     $NetBSD: vm_machdep.c,v 1.51 1999/05/14 02:12:00 nisimura Exp $ */
 
 /*
  * Copyright (c) 1994, 1995 Gordon W. Ross
@@ -69,10 +69,11 @@
 extern void proc_trampoline __P((void));
 
 /*
- * 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.
+ * 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_do_uret(). cpu_fork()
+ * returns once for forking parent p1. 
  */
 void
 cpu_fork(p1, p2, stack, stacksize)
diff -r 1f6ce8aa2114 -r 15e5ed11a225 sys/arch/x68k/x68k/vm_machdep.c
--- a/sys/arch/x68k/x68k/vm_machdep.c   Fri May 14 00:18:51 1999 +0000
+++ b/sys/arch/x68k/x68k/vm_machdep.c   Fri May 14 02:11:59 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.20 1999/05/13 21:58:36 thorpej Exp $  */
+/*     $NetBSD: vm_machdep.c,v 1.21 1999/05/14 02:11:59 nisimura Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -63,13 +63,11 @@
 #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.  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.
+ * 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. 
  */
 void
 cpu_fork(p1, p2, stack, stacksize)



Home | Main Index | Thread Index | Old Index