Allow the caller to specify a stack for the child process. If NULL,

the child inherits the stack pointer from the parent (traditional
behavior).  Like the signal stack, the stack area is secified as
a low address and a size; machine-dependent code accounts for stack
direction.

This is required for clone(2).
This commit is contained in:
thorpej 1999-05-13 21:58:32 +00:00
parent daf0e5b05c
commit c10a926030
24 changed files with 213 additions and 56 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.45 1999/03/26 23:41:26 mycroft Exp $ */
/* $NetBSD: vm_machdep.c,v 1.46 1999/05/13 21:58:32 thorpej 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.45 1999/03/26 23:41:26 mycroft Exp $");
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.46 1999/05/13 21:58:32 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -139,8 +139,10 @@ cpu_exit(p)
* the frame pointers on the stack after copying.
*/
void
cpu_fork(p1, p2)
cpu_fork(p1, p2, stack, stacksize)
register struct proc *p1, *p2;
void *stack;
size_t stacksize;
{
struct user *up = p2->p_addr;
int i;
@ -220,6 +222,12 @@ cpu_fork(p1, p2)
p2tf->tf_regs[FRAME_A3] = 0; /* no error */
p2tf->tf_regs[FRAME_A4] = 1; /* is child */
/*
* If specificed, give the child a different stack.
*/
if (stack != NULL)
p2tf->tf_regs[FRAME_SP] = (u_long)stack + stacksize;
/*
* Arrange for continuation at child_return(), which
* will return to exception_return(). Note that the child

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.42 1999/03/26 23:41:27 mycroft Exp $ */
/* $NetBSD: vm_machdep.c,v 1.43 1999/05/13 21:58:33 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -72,8 +72,10 @@
* the frame pointers on the stack after copying.
*/
void
cpu_fork(p1, p2)
cpu_fork(p1, p2, stack, stacksize)
register struct proc *p1, *p2;
void *stack;
size_t stacksize;
{
register struct pcb *pcb = &p2->p_addr->u_pcb;
register struct trapframe *tf;
@ -100,6 +102,13 @@ cpu_fork(p1, p2)
tf = (struct trapframe *)((u_int)p2->p_addr + USPACE) - 1;
p2->p_md.md_regs = (int *)tf;
*tf = *(struct trapframe *)p1->p_md.md_regs;
/*
* If specified, give the child a different stack.
*/
if (stack != NULL)
tf->tf_regs[15] = (u_int)stack + stacksize;
sf = (struct switchframe *)tf - 1;
sf->sf_pc = (u_int)proc_trampoline;
pcb->pcb_regs[6] = (int)child_return; /* A2 */

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.41 1999/03/30 21:01:42 mycroft Exp $ */
/* $NetBSD: vm_machdep.c,v 1.42 1999/05/13 21:58:33 thorpej Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@ -106,9 +106,11 @@ pt_entry_t *pmap_pte __P((pmap_t, vm_offset_t));
*/
void
cpu_fork(p1, p2)
cpu_fork(p1, p2, stack, stacksize)
struct proc *p1;
struct proc *p2;
void *stack;
size_t stacksize;
{
struct pcb *pcb = (struct pcb *)&p2->p_addr->u_pcb;
struct trapframe *tf;
@ -165,8 +167,14 @@ cpu_fork(p1, p2)
#endif /* ARMFPE */
p2->p_md.md_regs = tf = (struct trapframe *)pcb->pcb_sp - 1;
*tf = *p1->p_md.md_regs;
/*
* If specified, give the child a different stack.
*/
if (stack != NULL)
tf->tf_usr_sp = (u_int)stack + stacksize;
sf = (struct switchframe *)tf - 1;
sf->sf_spl = _SPL_0;
sf->sf_r4 = (u_int)child_return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.23 1999/03/26 23:41:28 mycroft Exp $ */
/* $NetBSD: vm_machdep.c,v 1.24 1999/05/13 21:58:33 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -73,8 +73,10 @@
* the frame pointers on the stack after copying.
*/
void
cpu_fork(p1, p2)
cpu_fork(p1, p2, stack, stacksize)
register struct proc *p1, *p2;
void *stack;
size_t stacksize;
{
register struct pcb *pcb = &p2->p_addr->u_pcb;
register struct trapframe *tf;
@ -101,6 +103,13 @@ cpu_fork(p1, p2)
tf = (struct trapframe *)((u_int)p2->p_addr + USPACE) - 1;
p2->p_md.md_regs = (int *)tf;
*tf = *(struct trapframe *)p1->p_md.md_regs;
/*
* If specified, give the child a different stack.
*/
if (stack != NULL)
tf->tf_regs[15] = (u_int)stack + stacksize;
sf = (struct switchframe *)tf - 1;
sf->sf_pc = (u_int)proc_trampoline;
pcb->pcb_regs[6] = (int)child_return; /* A2 */

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.47 1999/03/26 23:41:29 mycroft Exp $ */
/* $NetBSD: vm_machdep.c,v 1.48 1999/05/13 21:58:33 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -72,8 +72,10 @@
* the frame pointers on the stack after copying.
*/
void
cpu_fork(p1, p2)
cpu_fork(p1, p2, stack, stacksize)
struct proc *p1, *p2;
void *stack;
size_t stacksize;
{
struct pcb *pcb = &p2->p_addr->u_pcb;
struct trapframe *tf;
@ -100,6 +102,13 @@ cpu_fork(p1, p2)
tf = (struct trapframe *)((u_int)p2->p_addr + USPACE) - 1;
p2->p_md.md_regs = (int *)tf;
*tf = *(struct trapframe *)p1->p_md.md_regs;
/*
* If specified, give the child a different stack.
*/
if (stack != NULL)
tf->tf_regs[15] = (u_int)stack + stacksize;
sf = (struct switchframe *)tf - 1;
sf->sf_pc = (u_int)proc_trampoline;
pcb->pcb_regs[6] = (int)child_return; /* A2 */

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.77 1999/05/12 19:28:29 thorpej Exp $ */
/* $NetBSD: vm_machdep.c,v 1.78 1999/05/13 21:58:34 thorpej Exp $ */
/*-
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
@ -86,8 +86,10 @@ void setredzone __P((u_short *, caddr_t));
* the frame pointers on the stack after copying.
*/
void
cpu_fork(p1, p2)
cpu_fork(p1, p2, stack, stacksize)
register struct proc *p1, *p2;
void *stack;
size_t stacksize;
{
register struct pcb *pcb = &p2->p_addr->u_pcb;
register struct trapframe *tf;
@ -145,6 +147,13 @@ cpu_fork(p1, p2)
*/
p2->p_md.md_regs = tf = (struct trapframe *)pcb->pcb_tss.tss_esp0 - 1;
*tf = *p1->p_md.md_regs;
/*
* If specified, give the child a different stack.
*/
if (stack != NULL)
tf->tf_esp = (u_int)stack + stacksize;
sf = (struct switchframe *)tf - 1;
sf->sf_ppl = 0;
sf->sf_esi = (int)child_return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.36 1999/04/06 04:04:45 scottr Exp $ */
/* $NetBSD: vm_machdep.c,v 1.37 1999/05/13 21:58:34 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -72,8 +72,10 @@
* the frame pointers on the stack after copying.
*/
void
cpu_fork(p1, p2)
cpu_fork(p1, p2, stack, stacksize)
struct proc *p1, *p2;
void *stack;
size_t stacksize;
{
struct pcb *pcb = &p2->p_addr->u_pcb;
struct trapframe *tf;
@ -100,6 +102,13 @@ cpu_fork(p1, p2)
tf = (struct trapframe *)((u_int)p2->p_addr + USPACE) - 1;
p2->p_md.md_regs = (int *)tf;
*tf = *(struct trapframe *)p1->p_md.md_regs;
/*
* If specified, give the child a different stack.
*/
if (stack != NULL)
tf->tf_regs[15] = (u_int)stack + stacksize;
sf = (struct switchframe *)tf - 1;
sf->sf_pc = (u_int)proc_trampoline;
pcb->pcb_regs[6] = (int)child_return; /* A2 */

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.35 1999/04/24 08:10:42 simonb Exp $ */
/* $NetBSD: vm_machdep.c,v 1.36 1999/05/13 21:58:34 thorpej 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.35 1999/04/24 08:10:42 simonb Exp $");
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.36 1999/05/13 21:58:34 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -74,8 +74,10 @@ extern paddr_t kvtophys __P((vaddr_t)); /* XXX */
* cpu_fork() now returns just once.
*/
void
cpu_fork(p1, p2)
cpu_fork(p1, p2, stack, stacksize)
struct proc *p1, *p2;
void *stack;
size_t stacksize;
{
struct pcb *pcb;
struct frame *f;
@ -113,6 +115,12 @@ cpu_fork(p1, p2)
memcpy(f, p1->p_md.md_regs, sizeof(struct frame));
memset(((caddr_t) f) - 24, 0, 24);
/*
* If specified, give the child a different stack.
*/
if (stack != NULL)
f->f_regs[SP] = (u_int)stack + stacksize;
p2->p_md.md_regs = (void *)f;
p2->p_md.md_flags = p1->p_md.md_flags & MDP_FPUSED;
x = (CPUISMIPS3) ? (MIPS3_PG_G|MIPS3_PG_RO|MIPS3_PG_WIRED) : MIPS1_PG_G;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.20 1999/03/26 23:41:32 mycroft Exp $ */
/* $NetBSD: vm_machdep.c,v 1.21 1999/05/13 21:58:34 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -74,8 +74,10 @@
* the frame pointers on the stack after copying.
*/
void
cpu_fork(p1, p2)
cpu_fork(p1, p2, stack, stacksize)
struct proc *p1, *p2;
void *stack;
size_t stacksize;
{
struct pcb *pcb = &p2->p_addr->u_pcb;
struct trapframe *tf;
@ -103,6 +105,13 @@ cpu_fork(p1, p2)
tf = (struct trapframe *)((u_int)p2->p_addr + USPACE) - 1;
p2->p_md.md_regs = (int *)tf;
*tf = *(struct trapframe *)p1->p_md.md_regs;
/*
* If specified, give the child a different stack.
*/
if (stack != NULL)
tf->tf_regs[15] = (u_int)stack + stacksize;
sf = (struct switchframe *)tf - 1;
sf->sf_pc = (u_int)proc_trampoline;
pcb->pcb_regs[6] = (int)child_return; /* A2 */

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.9 1999/03/26 23:41:33 mycroft Exp $ */
/* $NetBSD: vm_machdep.c,v 1.10 1999/05/13 21:58:34 thorpej Exp $ */
/*
* This file was taken from mvme68k/mvme68k/vm_machdep.c
@ -83,8 +83,10 @@
* the frame pointers on the stack after copying.
*/
void
cpu_fork(p1, p2)
cpu_fork(p1, p2, stack, stacksize)
struct proc *p1, *p2;
void *stack;
size_t stacksize;
{
struct pcb *pcb = &p2->p_addr->u_pcb;
struct trapframe *tf;
@ -112,6 +114,13 @@ cpu_fork(p1, p2)
tf = (struct trapframe *)((u_int)p2->p_addr + USPACE) - 1;
p2->p_md.md_regs = (int *)tf;
*tf = *(struct trapframe *)p1->p_md.md_regs;
/*
* If specified, give the child a different stack.
*/
if (stack != NULL)
tf->tf_regs[15] = (u_int)stack + stacksize;
sf = (struct switchframe *)tf - 1;
sf->sf_pc = (u_int)proc_trampoline;
pcb->pcb_regs[6] = (int)child_return; /* A2 */

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.31 1999/03/24 05:51:09 mrg Exp $ */
/* $NetBSD: vm_machdep.c,v 1.32 1999/05/13 21:58:35 thorpej Exp $ */
/*-
* Copyright (c) 1996 Matthias Pfaller.
@ -75,8 +75,10 @@ void setredzone __P((u_short *, caddr_t));
* via proc_trampoline from cpu_switch.
*/
void
cpu_fork(p1, p2)
cpu_fork(p1, p2, stack, stacksize)
register struct proc *p1, *p2;
void *stack;
size_t stacksize;
{
register struct pcb *pcb = &p2->p_addr->u_pcb;
register struct syscframe *tf;
@ -104,6 +106,13 @@ cpu_fork(p1, p2)
* through rei(). Note the in-line cpu_set_kpc().
*/
tf = (struct syscframe *)((u_int)p2->p_addr + USPACE) - 1;
/*
* If specified, give the child a different stack.
*/
if (stack != NULL)
tf->sf_regs.r_sp = (u_int)stack + stacksize;
p2->p_md.md_regs = &tf->sf_regs;
sf = (struct switchframe *)tf - 1;
sf->sf_p = p2;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.9 1999/03/26 23:41:34 mycroft Exp $ */
/* $NetBSD: vm_machdep.c,v 1.10 1999/05/13 21:58:35 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -50,8 +50,10 @@
* Finish a fork operation, with process p2 nearly set up.
*/
void
cpu_fork(p1, p2)
cpu_fork(p1, p2, stack, stacksize)
struct proc *p1, *p2;
void *stack;
size_t stacksize;
{
struct trapframe *tf;
struct callframe *cf;
@ -82,6 +84,13 @@ cpu_fork(p1, p2)
stktop1 = (caddr_t)trapframe(p1);
stktop2 = (caddr_t)trapframe(p2);
bcopy(stktop1, stktop2, sizeof(struct trapframe));
/*
* If specified, give the child a different stack.
*/
if (stack != NULL)
tf->fixreg[1] = (register_t)stack + stacksize;
stktop2 = (caddr_t)((u_long)stktop2 & ~15); /* Align stack pointer */
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.44 1999/03/26 23:41:36 mycroft Exp $ */
/* $NetBSD: vm_machdep.c,v 1.45 1999/05/13 21:58:35 thorpej Exp $ */
/*
* Copyright (c) 1996
@ -191,8 +191,10 @@ vunmapbuf(bp, len)
* the first element in struct user.
*/
void
cpu_fork(p1, p2)
cpu_fork(p1, p2, stack, stacksize)
struct proc *p1, *p2;
void *stack;
size_t stacksize;
{
struct pcb *opcb = &p1->p_addr->u_pcb;
struct pcb *npcb = &p2->p_addr->u_pcb;
@ -245,6 +247,12 @@ cpu_fork(p1, p2)
/* Copy parent's trapframe */
*tf2 = *(struct trapframe *)((int)opcb + USPACE - sizeof(*tf2));
/*
* If specified, give the child a different stack.
*/
if (stack != NULL)
tf2->tf_out[6] = (u_int)stack + stacksize;
/* Duplicate efforts of syscall(), but slightly differently */
if (tf2->tf_global[1] & SYSCALL_G2RFLAG) {
/* jmp %g2 (or %g7, deprecated) on success */

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.15 1999/03/26 23:41:36 mycroft Exp $ */
/* $NetBSD: vm_machdep.c,v 1.16 1999/05/13 21:58:36 thorpej Exp $ */
/*
* Copyright (c) 1996
@ -215,8 +215,10 @@ char cpu_forkname[] = "cpu_fork()";
* the first element in struct user.
*/
void
cpu_fork(p1, p2)
cpu_fork(p1, p2, stack, stacksize)
register struct proc *p1, *p2;
void *stack;
size_t stacksize;
{
register struct pcb *opcb = &p1->p_addr->u_pcb;
register struct pcb *npcb = &p2->p_addr->u_pcb;
@ -286,6 +288,12 @@ cpu_fork(p1, p2)
/* Copy parent's trapframe */
*tf2 = *(struct trapframe *)((long)opcb + USPACE - sizeof(*tf2));
/*
* If specified, give the child a different stack.
*/
if (stack != NULL)
tf2->tf_out[6] = (u_int64_t)stack + stacksize;
/* Duplicate efforts of syscall(), but slightly differently */
if (tf2->tf_global[1] & SYSCALL_G2RFLAG) {
/* jmp %g2 (or %g7, deprecated) on success */

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.49 1999/04/07 06:07:59 gwr Exp $ */
/* $NetBSD: vm_machdep.c,v 1.50 1999/05/13 21:58:36 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995 Gordon W. Ross
@ -75,8 +75,10 @@ extern void proc_trampoline __P((void));
* than the parent. Returns 1 in the child process, 0 in the parent.
*/
void
cpu_fork(p1, p2)
cpu_fork(p1, p2, stack, stacksize)
register struct proc *p1, *p2;
void *stack;
size_t stacksize;
{
register struct pcb *p1pcb = &p1->p_addr->u_pcb;
register struct pcb *p2pcb = &p2->p_addr->u_pcb;
@ -121,6 +123,12 @@ cpu_fork(p1, p2)
p2->p_md.md_regs = (int *)p2tf;
bcopy(p1->p_md.md_regs, p2tf, sizeof(*p2tf));
/*
* If specified, give the child a different stack.
*/
if (stack != NULL)
p2tf->tf_regs[15] = (u_int)stack + stacksize;
/*
* Create a "switch frame" such that when cpu_switch returns,
* this process will be in proc_do_uret() going to user mode.

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.48 1999/05/02 17:28:43 ragge Exp $ */
/* $NetBSD: vm_machdep.c,v 1.49 1999/05/13 21:58:36 thorpej Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@ -93,8 +93,10 @@ pagemove(from, to, size)
* forking.
*/
void
cpu_fork(p1, p2)
cpu_fork(p1, p2, stack, stacksize)
struct proc *p1, *p2;
void *stack;
size_t stacksize;
{
struct pte *pt;
struct pcb *nyproc;
@ -131,6 +133,13 @@ cpu_fork(p1, p2)
/* General registers as taken from userspace */
/* trapframe should be synced with pcb */
bcopy(&tf->r2,&nyproc->R[2],10*sizeof(int));
/*
* If specified, give the child a different stack.
*/
if (stack != NULL)
tf->sp = (u_long)stack + stacksize;
nyproc->AP = tf->ap;
nyproc->FP = tf->fp;
nyproc->USP = tf->sp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.19 1999/03/26 23:41:39 mycroft Exp $ */
/* $NetBSD: vm_machdep.c,v 1.20 1999/05/13 21:58:36 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -72,8 +72,10 @@
* the frame pointers on the stack after copying.
*/
void
cpu_fork(p1, p2)
cpu_fork(p1, p2, stack, stacksize)
struct proc *p1, *p2;
void *stack;
size_t stacksize;
{
struct pcb *pcb = &p2->p_addr->u_pcb;
struct trapframe *tf;
@ -100,6 +102,13 @@ cpu_fork(p1, p2)
tf = (struct trapframe *)((u_int)p2->p_addr + USPACE) - 1;
p2->p_md.md_regs = (int *)tf;
*tf = *(struct trapframe *)p1->p_md.md_regs;
/*
* If specified, give the child a different stack.
*/
if (stack != NULL)
tf->tf_regs[15] = (u_int)stack + stacksize;
sf = (struct switchframe *)tf - 1;
sf->sf_pc = (u_int)proc_trampoline;
pcb->pcb_regs[6] = (int)child_return; /* A2 */

View File

@ -1,4 +1,4 @@
/* $NetBSD: init_main.c,v 1.150 1999/05/13 00:59:04 thorpej Exp $ */
/* $NetBSD: init_main.c,v 1.151 1999/05/13 21:58:37 thorpej Exp $ */
/*
* Copyright (c) 1995 Christopher G. Demetriou. All rights reserved.
@ -404,7 +404,7 @@ main()
siginit(p);
/* Create process 1 (init(8)). */
if (fork1(p, 0, SIGCHLD, NULL, &initproc))
if (fork1(p, 0, SIGCHLD, NULL, 0, NULL, &initproc))
panic("fork init");
cpu_set_kpc(initproc, start_init, initproc);

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_fork.c,v 1.58 1999/05/13 00:59:04 thorpej Exp $ */
/* $NetBSD: kern_fork.c,v 1.59 1999/05/13 21:58:37 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1991, 1993
@ -77,7 +77,7 @@ sys_fork(p, v, retval)
register_t *retval;
{
return (fork1(p, 0, SIGCHLD, retval, NULL));
return (fork1(p, 0, SIGCHLD, NULL, 0, retval, NULL));
}
/*
@ -92,7 +92,7 @@ sys_vfork(p, v, retval)
register_t *retval;
{
return (fork1(p, FORK_PPWAIT, SIGCHLD, retval, NULL));
return (fork1(p, FORK_PPWAIT, SIGCHLD, NULL, 0, retval, NULL));
}
/*
@ -107,14 +107,17 @@ sys___vfork14(p, v, retval)
register_t *retval;
{
return (fork1(p, FORK_PPWAIT|FORK_SHAREVM, SIGCHLD, retval, NULL));
return (fork1(p, FORK_PPWAIT|FORK_SHAREVM, SIGCHLD, NULL, 0,
retval, NULL));
}
int
fork1(p1, flags, exitsig, retval, rnewprocp)
fork1(p1, flags, exitsig, stack, stacksize, retval, rnewprocp)
register struct proc *p1;
int flags;
int exitsig;
void *stack;
size_t stacksize;
register_t *retval;
struct proc **rnewprocp;
{
@ -344,7 +347,8 @@ again:
* different path later.
*/
p2->p_addr = (struct user *)uaddr;
uvm_fork(p1, p2, (flags & FORK_SHAREVM) ? TRUE : FALSE);
uvm_fork(p1, p2, (flags & FORK_SHAREVM) ? TRUE : FALSE,
stack, stacksize);
/*
* Make child runnable, set start time, and add to run queue.

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_kthread.c,v 1.6 1999/05/13 00:59:04 thorpej Exp $ */
/* $NetBSD: kern_kthread.c,v 1.7 1999/05/13 21:58:37 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@ -76,7 +76,7 @@ kthread_create(func, arg, newpp, fmt, va_alist)
/* First, create the new process. */
error = fork1(&proc0, FORK_SHAREVM | FORK_SHARECWD | FORK_SHAREFILES |
FORK_SHARESIGS, SIGCHLD, NULL, &p2);
FORK_SHARESIGS, SIGCHLD, NULL, 0, NULL, &p2);
if (error)
return (error);

View File

@ -1,4 +1,4 @@
/* $NetBSD: proc.h,v 1.76 1999/05/13 00:59:03 thorpej Exp $ */
/* $NetBSD: proc.h,v 1.77 1999/05/13 21:58:37 thorpej Exp $ */
/*-
* Copyright (c) 1986, 1989, 1991, 1993
@ -357,7 +357,8 @@ void wakeup __P((void *chan));
void reaper __P((void));
void exit1 __P((struct proc *, int));
void exit2 __P((struct proc *));
int fork1 __P((struct proc *, int, int, register_t *, struct proc **));
int fork1 __P((struct proc *, int, int, void *, size_t, register_t *,
struct proc **));
void kmeminit __P((void));
void rqinit __P((void));
int groupmember __P((gid_t, struct ucred *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_extern.h,v 1.24 1999/04/11 04:04:11 chs Exp $ */
/* $NetBSD: uvm_extern.h,v 1.25 1999/05/13 21:58:38 thorpej Exp $ */
/*
*
@ -274,7 +274,8 @@ int uvm_fault __P((vm_map_t, vaddr_t,
#if defined(KGDB)
void uvm_chgkprot __P((caddr_t, size_t, int));
#endif
void uvm_fork __P((struct proc *, struct proc *, boolean_t));
void uvm_fork __P((struct proc *, struct proc *, boolean_t,
void *, size_t));
void uvm_exit __P((struct proc *));
void uvm_init_limits __P((struct proc *));
boolean_t uvm_kernacc __P((caddr_t, size_t, int));

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_glue.c,v 1.19 1999/04/30 21:23:50 thorpej Exp $ */
/* $NetBSD: uvm_glue.c,v 1.20 1999/05/13 21:58:38 thorpej Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@ -256,6 +256,8 @@ uvm_vsunlock(p, addr, len)
* - the address space is copied as per parent map's inherit values
* - a new "user" structure is allocated for the child process
* [filled in by MD layer...]
* - if specified, the child gets a new user stack described by
* stack and stacksize
* - NOTE: the kernel stack may be at a different location in the child
* process, and thus addresses of automatic variables may be invalid
* after cpu_fork returns in the child process. We do nothing here
@ -264,9 +266,11 @@ uvm_vsunlock(p, addr, len)
* than just hang
*/
void
uvm_fork(p1, p2, shared)
uvm_fork(p1, p2, shared, stack, stacksize)
struct proc *p1, *p2;
boolean_t shared;
void *stack;
size_t stacksize;
{
struct user *up = p2->p_addr;
int rv;
@ -304,7 +308,7 @@ uvm_fork(p1, p2, shared)
* the child ready to run. The child will exit directly to user
* mode on its first time slice, and will not return here.
*/
cpu_fork(p1, p2);
cpu_fork(p1, p2, stack, stacksize);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_extern.h,v 1.44 1999/04/10 13:52:11 drochner Exp $ */
/* $NetBSD: vm_extern.h,v 1.45 1999/05/13 21:58:38 thorpej Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -63,7 +63,7 @@ void thread_sleep_msg __P((void *, simple_lock_t,
void vmapbuf __P((struct buf *, vsize_t));
void vunmapbuf __P((struct buf *, vsize_t));
void pagemove __P((caddr_t, caddr_t, size_t));
void cpu_fork __P((struct proc *, struct proc *));
void cpu_fork __P((struct proc *, struct proc *, void *, size_t));
#ifndef cpu_swapin
void cpu_swapin __P((struct proc *));
#endif