summaryrefslogtreecommitdiff
path: root/sys/arch/amd64/amd64/vm_machdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/amd64/amd64/vm_machdep.c')
-rw-r--r--sys/arch/amd64/amd64/vm_machdep.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/arch/amd64/amd64/vm_machdep.c b/sys/arch/amd64/amd64/vm_machdep.c
index f75fbc7bf86..43c83eb5630 100644
--- a/sys/arch/amd64/amd64/vm_machdep.c
+++ b/sys/arch/amd64/amd64/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.4 2004/09/20 17:51:05 miod Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.5 2005/10/28 21:57:31 kettenis Exp $ */
/* $NetBSD: vm_machdep.c,v 1.1 2003/04/26 18:39:33 fvdl Exp $ */
/*-
@@ -146,10 +146,11 @@ cpu_fork(struct proc *p1, struct proc *p2, void *stack, size_t stacksize,
sf = (struct switchframe *)tf - 1;
sf->sf_r12 = (u_int64_t)func;
sf->sf_r13 = (u_int64_t)arg;
- if (func == child_return)
- sf->sf_rip = (u_int64_t)child_trampoline;
- else
+ /* XXX fork of init(8) returns via proc_trampoline() */
+ if (p2->p_pid == 1)
sf->sf_rip = (u_int64_t)proc_trampoline;
+ else
+ sf->sf_rip = (u_int64_t)child_trampoline;
pcb->pcb_rsp = (u_int64_t)sf;
pcb->pcb_rbp = 0;
}