summaryrefslogtreecommitdiff
path: root/sys/uvm
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-11-06 18:41:11 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-11-06 18:41:11 +0000
commit89ae7820c1a454d61cd281925d300bf324cfb4a3 (patch)
tree322119c116dc2ae1a396e832aac803b47d2df136 /sys/uvm
parent1c0a1a534d87ced0c6089cb972b59491152bbdfa (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/uvm')
-rw-r--r--sys/uvm/uvm_extern.h18
-rw-r--r--sys/uvm/uvm_glue.c16
2 files changed, 14 insertions, 20 deletions
diff --git a/sys/uvm/uvm_extern.h b/sys/uvm/uvm_extern.h
index 249713f25f6..c294b3d2987 100644
--- a/sys/uvm/uvm_extern.h
+++ b/sys/uvm/uvm_extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_extern.h,v 1.27 2001/11/06 13:36:52 art Exp $ */
+/* $OpenBSD: uvm_extern.h,v 1.28 2001/11/06 18:41:10 art Exp $ */
/* $NetBSD: uvm_extern.h,v 1.48 2000/08/12 22:41:55 thorpej Exp $ */
/*
@@ -426,17 +426,6 @@ struct core;
#ifdef _KERNEL
-/* vm_machdep.c */
-void vmapbuf __P((struct buf *, vsize_t));
-void vunmapbuf __P((struct buf *, vsize_t));
-void pagemove __P((caddr_t, caddr_t, size_t));
-#ifndef cpu_swapin
-void cpu_swapin __P((struct proc *));
-#endif
-#ifndef cpu_swapout
-void cpu_swapout __P((struct proc *));
-#endif
-
/* uvm_aobj.c */
struct uvm_object *uao_create __P((vsize_t, int));
void uao_detach __P((struct uvm_object *));
@@ -454,7 +443,7 @@ int uvm_fault __P((vm_map_t, vaddr_t,
void uvm_chgkprot __P((caddr_t, size_t, int));
#endif
void uvm_fork __P((struct proc *, struct proc *, boolean_t,
- void *, size_t));
+ void *, size_t, void (*)(void *), void *));
void uvm_exit __P((struct proc *));
void uvm_init_limits __P((struct proc *));
boolean_t uvm_kernacc __P((caddr_t, size_t, int));
@@ -581,7 +570,8 @@ void swstrategy __P((struct buf *));
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 *, size_t));
+void cpu_fork __P((struct proc *, struct proc *, void *, size_t,
+ void (*)(void *), void *));
#ifndef cpu_swapin
void cpu_swapin __P((struct proc *));
#endif
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);
}
/*