summaryrefslogtreecommitdiffstats
path: root/sys/uvm/uvm_glue.c
diff options
context:
space:
mode:
authorart <art@openbsd.org>2001-11-06 18:41:09 +0000
committerart <art@openbsd.org>2001-11-06 18:41:09 +0000
commit1359e66cac17161a0340876a35cefdf01fe6f0a9 (patch)
treebeef7a915dd004044e12159969cc63fedac994f0 /sys/uvm/uvm_glue.c
parentSince the header of the file map is Start End, (diff)
downloadwireguard-openbsd-1359e66cac17161a0340876a35cefdf01fe6f0a9.tar.xz
wireguard-openbsd-1359e66cac17161a0340876a35cefdf01fe6f0a9.zip
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/uvm/uvm_glue.c')
-rw-r--r--sys/uvm/uvm_glue.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/uvm/uvm_glue.c b/sys/uvm/uvm_glue.c
index ba10fa92b50..95f24367cc1 100644
--- a/sys/uvm/uvm_glue.c
+++ b/sys/uvm/uvm_glue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_glue.c,v 1.23 2001/11/06 13:36:52 art Exp $ */
+/* $OpenBSD: uvm_glue.c,v 1.24 2001/11/06 18:41:10 art Exp $ */
/* $NetBSD: uvm_glue.c,v 1.40 2000/08/21 02:29:32 thorpej Exp $ */
/*
@@ -265,11 +265,13 @@ uvm_vsunlock(p, addr, len)
* than just hang
*/
void
-uvm_fork(p1, p2, shared, stack, stacksize)
+uvm_fork(p1, p2, shared, stack, stacksize, func, arg)
struct proc *p1, *p2;
boolean_t shared;
void *stack;
size_t stacksize;
+ void (*func) __P((void *));
+ void *arg;
{
struct user *up = p2->p_addr;
int rv;
@@ -306,11 +308,13 @@ uvm_fork(p1, p2, shared, stack, stacksize)
(caddr_t)&up->u_stats.pstat_startcopy));
/*
- * cpu_fork will copy and update the kernel stack and pcb, and make
- * 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() copy and update the pcb, and make the child ready
+ * to run. If this is a normal user fork, the child will exit
+ * directly to user mode via child_return() on its first time
+ * slice and will not return here. If this is a kernel thread,
+ * the specified entry point will be executed.
*/
- cpu_fork(p1, p2, stack, stacksize);
+ cpu_fork(p1, p2, stack, stacksize, func, arg);
}
/*