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).
This commit is contained in:
sommerfeld 2000-01-20 22:18:54 +00:00
parent ad4e686817
commit aa195e816f
20 changed files with 312 additions and 117 deletions

View File

@ -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 @@ cpu_exit(p)
/*
* 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)

View File

@ -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)

View File

@ -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 @@ pt_entry_t *pmap_pte __P((pmap_t, vm_offset_t));
/*
* 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

View File

@ -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)

View File

@ -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)

View File

@ -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 @@ void setredzone __P((u_short *, caddr_t));
/*
* 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)

View File

@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.1 2000/01/05 08:49:04 nisimura Exp
#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)

View File

@ -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
* 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)

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.46 2000/01/09 08:01:55 shin Exp $ */
/* $NetBSD: vm_machdep.c,v 1.47 2000/01/20 22:18:57 sommerfeld 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.46 2000/01/09 08:01:55 shin Exp $");
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.47 2000/01/20 22:18:57 sommerfeld Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -72,11 +72,21 @@ extern struct proc *fpcurproc;
extern paddr_t kvtophys __P((vaddr_t)); /* XXX */
/*
* 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)

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.27 1999/12/04 21:20:56 ragge Exp $ */
/* $NetBSD: vm_machdep.c,v 1.28 2000/01/20 22:18:57 sommerfeld Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -65,11 +65,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)

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.1 1999/12/09 14:53:18 tsutsui Exp $ */
/* $NetBSD: vm_machdep.c,v 1.2 2000/01/20 22:18:57 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)

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.15 1999/12/04 21:21:04 ragge Exp $ */
/* $NetBSD: vm_machdep.c,v 1.16 2000/01/20 22:18:58 sommerfeld Exp $ */
/*
* This file was taken from mvme68k/mvme68k/vm_machdep.c
@ -75,12 +75,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)

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.39 1999/12/04 21:21:14 ragge Exp $ */
/* $NetBSD: vm_machdep.c,v 1.40 2000/01/20 22:18:58 sommerfeld Exp $ */
/*-
* Copyright (c) 1996 Matthias Pfaller.
@ -68,9 +68,20 @@ void setredzone __P((u_short *, caddr_t));
/*
* Finish a fork operation, with process p2 nearly set up.
* Copy the pcb and setup the kernel stack for the child.
* Setup the child's stackframe to return to child_return
* via proc_trampoline from cpu_switch.
* 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)

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.14 1999/11/13 00:30:43 thorpej Exp $ */
/* $NetBSD: vm_machdep.c,v 1.15 2000/01/20 22:18:58 sommerfeld Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -48,6 +48,20 @@
/*
* 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
* fork_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)

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.6 2000/01/07 12:01:00 msaitoh Exp $ */
/* $NetBSD: vm_machdep.c,v 1.7 2000/01/20 22:18:59 sommerfeld Exp $ */
/*-
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
@ -66,12 +66,20 @@ void setredzone __P((u_short *, caddr_t));
/*
* 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)

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.50 1999/12/04 21:21:32 ragge Exp $ */
/* $NetBSD: vm_machdep.c,v 1.51 2000/01/20 22:18:59 sommerfeld Exp $ */
/*
* Copyright (c) 1996
@ -184,11 +184,20 @@ vunmapbuf(bp, len)
/*
* Finish a fork operation, with process p2 nearly set up.
* Copy and update the pcb, making the child ready to run, and marking
* it so that it can return differently than the parent.
* 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.
*
* This function relies on the fact that the pcb is
* the first element in struct user.
* 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)

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.24 1999/12/30 16:42:10 eeh Exp $ */
/* $NetBSD: vm_machdep.c,v 1.25 2000/01/20 22:18:59 sommerfeld Exp $ */
/*
* Copyright (c) 1996
@ -210,11 +210,20 @@ char cpu_forkname[] = "cpu_fork()";
/*
* Finish a fork operation, with process p2 nearly set up.
* Copy and update the pcb, making the child ready to run, and marking
* it so that it can return differently than the parent.
* 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.
*
* This function relies on the fact that the pcb is
* the first element in struct user.
* 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)

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.56 1999/12/04 21:21:45 ragge Exp $ */
/* $NetBSD: vm_machdep.c,v 1.57 2000/01/20 22:18:59 sommerfeld Exp $ */
/*
* Copyright (c) 1994, 1995 Gordon W. Ross
@ -69,11 +69,21 @@ extern void proc_do_uret __P((void));
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.
* When scheduled, child p2 will start from proc_do_uret(). 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_do_uret() 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)

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.55 1999/10/22 21:14:34 ragge Exp $ */
/* $NetBSD: vm_machdep.c,v 1.56 2000/01/20 22:19:00 sommerfeld Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@ -84,6 +84,22 @@ pagemove(from, to, size)
}
/*
* 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.
*
* cpu_fork() copies parent process trapframe directly into child PCB
* so that when we swtch() to the child process it will go directly
* back to user mode without any need to jump back through kernel.

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.28 1999/12/04 21:21:50 ragge Exp $ */
/* $NetBSD: vm_machdep.c,v 1.29 2000/01/20 22:19:00 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
* 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)