diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2017-02-12 04:55:09 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2017-02-12 04:55:09 +0000 |
commit | 89043ff36c6d6b7d281d035919b813f9866d1e68 (patch) | |
tree | 876e1797e6617d45dc347d704757015e0635dd5b /sys/arch/mips64 | |
parent | 68a5515f6186c6c1d00d6abe9453463fbdc66c99 (diff) |
Split up fork1():
- FORK_THREAD handling is a totally separate function, thread_fork(),
that is only used by sys___tfork() and which loses the flags, func,
arg, and newprocp parameters and gains tcb parameter to guarantee
the new thread's TCB is set before the creating thread returns
- fork1() loses its stack and tidptr parameters
Common bits factor out:
- struct proc allocation and initialization moves to thread_new()
- maxthread handling moves to fork_check_maxthread()
- setting the new thread running moves to fork_thread_start()
The MD cpu_fork() function swaps its unused stacksize parameter for
a tcb parameter.
luna88k testing by aoyama@, alpha testing by dlg@
ok mpi@
Diffstat (limited to 'sys/arch/mips64')
-rw-r--r-- | sys/arch/mips64/mips64/vm_machdep.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/sys/arch/mips64/mips64/vm_machdep.c b/sys/arch/mips64/mips64/vm_machdep.c index f49bed30773..366d7c6969a 100644 --- a/sys/arch/mips64/mips64/vm_machdep.c +++ b/sys/arch/mips64/mips64/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.33 2016/03/06 19:42:27 mpi Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.34 2017/02/12 04:55:08 guenther Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1992, 1993 @@ -61,12 +61,8 @@ extern void proc_trampoline(void); * Finish a fork operation, with process p2 nearly set up. */ void -cpu_fork(p1, p2, stack, stacksize, func, arg) - struct proc *p1, *p2; - void *stack; - size_t stacksize; - void (*func)(void *); - void *arg; +cpu_fork(struct proc *p1, struct proc *p2, void *stack, void *tcb, + void (*func)(void *), void *arg) { struct cpu_info *ci = curcpu(); struct pcb *pcb; @@ -117,10 +113,12 @@ cpu_fork(p1, p2, stack, stacksize, func, arg) p2->p_md.md_regs = &p2->p_addr->u_pcb.pcb_regs; /* - * If specified, give the child a different stack. + * If specified, give the child a different stack and/or TCB. */ if (stack != NULL) - p2->p_md.md_regs->sp = (u_int64_t)stack + stacksize; + p2->p_md.md_regs->sp = (u_int64_t)stack; + if (tcb != NULL) + TCB_SET(p2, tcb); /* * Copy the process control block to the new proc and |