summaryrefslogtreecommitdiff
path: root/sys/arch/m68k
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/arch/m68k
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/arch/m68k')
-rw-r--r--sys/arch/m68k/m68k/m68k_machdep.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/sys/arch/m68k/m68k/m68k_machdep.c b/sys/arch/m68k/m68k/m68k_machdep.c
index 4b0c39194b8..287d064859f 100644
--- a/sys/arch/m68k/m68k/m68k_machdep.c
+++ b/sys/arch/m68k/m68k/m68k_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m68k_machdep.c,v 1.1 1997/07/06 07:46:28 downsj Exp $ */
+/* $OpenBSD: m68k_machdep.c,v 1.2 2001/11/06 18:41:09 art Exp $ */
/* $NetBSD: m68k_machdep.c,v 1.3 1997/06/12 09:57:04 veego Exp $ */
/*-
@@ -38,7 +38,37 @@
*/
#include <sys/param.h>
+#include <sys/proc.h>
+#include <sys/syscall.h>
+#include <sys/ktrace.h>
+
+#include <machine/frame.h>
+#include <machine/reg.h>
/* the following is used externally (sysctl_hw) */
char machine_arch[] = MACHINE_ARCH; /* from <machine/param.h> */
+void userret __P((struct proc *, int, u_quad_t)); /* XXX */
+/*
+ * Process the tail end of a fork() for the child
+ *
+ * XXX - this is probably the wrong file.
+ */
+void
+child_return(arg)
+ void *arg;
+{
+ struct proc *p = (struct proc *)arg;
+ struct frame *f = (struct frame *)p->p_md.md_regs;
+
+ f->f_regs[D0] = 0;
+ f->f_sr &= ~PSL_C; /* carry bit */
+ f->f_format = FMT0;
+
+ userret(p, f->f_pc, p->p_sticks);
+#ifdef KTRACE
+ if (KTRPOINT(p, KTR_SYSRET))
+ ktrsysret(p, SYS_fork, 0, 0);
+#endif
+}
+