diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2001-11-06 18:41:11 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2001-11-06 18:41:11 +0000 |
commit | 89ae7820c1a454d61cd281925d300bf324cfb4a3 (patch) | |
tree | 322119c116dc2ae1a396e832aac803b47d2df136 /sys/arch/mvme68k | |
parent | 1c0a1a534d87ced0c6089cb972b59491152bbdfa (diff) |
Let fork1, uvm_fork, and cpu_fork take a function/argument pair as argument,
instead of doing fork1, cpu_set_kpc. This lets us retire cpu_set_kpc and
avoid a multiprocessor race.
This commit breaks vax because it doesn't look like any other arch, someone
working on vax might want to look at this and try to adapt the code to be
more like the rest of the world.
Idea and uvm parts from NetBSD.
Diffstat (limited to 'sys/arch/mvme68k')
-rw-r--r-- | sys/arch/mvme68k/mvme68k/trap.c | 23 | ||||
-rw-r--r-- | sys/arch/mvme68k/mvme68k/vm_machdep.c | 30 |
2 files changed, 14 insertions, 39 deletions
diff --git a/sys/arch/mvme68k/mvme68k/trap.c b/sys/arch/mvme68k/mvme68k/trap.c index 3c74d079b93..84c62fd0794 100644 --- a/sys/arch/mvme68k/mvme68k/trap.c +++ b/sys/arch/mvme68k/mvme68k/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.35 2001/09/14 09:15:19 art Exp $ */ +/* $OpenBSD: trap.c,v 1.36 2001/11/06 18:41:10 art Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -169,14 +169,14 @@ u_char next_sir; int writeback __P((struct frame *fp, int docachepush)); -static inline void userret __P((struct proc *p, struct frame *fp, +void userret __P((struct proc *p, struct frame *fp, u_quad_t oticks, u_int faultaddr, int fromtrap)); /* * trap and syscall both need the following work done before returning * to user mode. */ -static inline void +void userret(p, fp, oticks, faultaddr, fromtrap) register struct proc *p; register struct frame *fp; @@ -1104,23 +1104,6 @@ bad: #endif } -void -child_return(p, frame) - struct proc *p; - struct frame frame; -{ - - frame.f_regs[D0] = 0; - frame.f_sr &= ~PSL_C; - frame.f_format = FMT0; - - userret(p, &frame, 0, (u_int)0, 0); -#ifdef KTRACE - if (KTRPOINT(p, KTR_SYSRET)) - ktrsysret(p, SYS_fork, 0, 0); -#endif -} - /* * Allocation routines for software interrupts. */ diff --git a/sys/arch/mvme68k/mvme68k/vm_machdep.c b/sys/arch/mvme68k/mvme68k/vm_machdep.c index 091be388e0f..0600b7da920 100644 --- a/sys/arch/mvme68k/mvme68k/vm_machdep.c +++ b/sys/arch/mvme68k/mvme68k/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.30 2001/09/29 21:26:33 miod Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.31 2001/11/06 18:41:10 art Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -69,14 +69,16 @@ */ void -cpu_fork(p1, p2, stack, stacksize) - register struct proc *p1, *p2; +cpu_fork(p1, p2, stack, stacksize, func, arg) + struct proc *p1, *p2; void *stack; size_t stacksize; + void (*func)(void *); + void *arg; { - register struct pcb *pcb = &p2->p_addr->u_pcb; - register struct trapframe *tf; - register struct switchframe *sf; + struct pcb *pcb = &p2->p_addr->u_pcb; + struct trapframe *tf; + struct switchframe *sf; extern struct pcb *curpcb; extern void proc_trampoline(), child_return(); @@ -95,7 +97,7 @@ cpu_fork(p1, p2, stack, stacksize) /* * Copy the trap frame, and arrange for the child to return directly - * through return_to_user(). Note the inline version of cpu_set_kpc(). + * through return_to_user(). */ tf = (struct trapframe *)((u_int)p2->p_addr + USPACE) - 1; p2->p_md.md_regs = (int *)tf; @@ -109,21 +111,11 @@ cpu_fork(p1, p2, stack, stacksize) sf = (struct switchframe *)tf - 1; sf->sf_pc = (u_int)proc_trampoline; - pcb->pcb_regs[6] = (int)child_return; /* A2 */ - pcb->pcb_regs[7] = (int)p2; /* A3 */ + pcb->pcb_regs[6] = (int)func; /* A2 */ + pcb->pcb_regs[7] = (int)arg; /* A3 */ pcb->pcb_regs[11] = (int)sf; /* SSP */ } -void -cpu_set_kpc(p, pc, arg) - struct proc *p; - void (*pc) __P((void *)); - void *arg; -{ - p->p_addr->u_pcb.pcb_regs[6] = (int)pc; /* A2 */ - p->p_addr->u_pcb.pcb_regs[7] = (int)arg; /* A3 */ -} - /* * cpu_exit is called as the last action during exit. * We release the address space and machine-dependent resources, |