summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/vm_machdep.c4
-rw-r--r--sys/i386/i386/vm_machdep.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c
index 22625b2..232ac42 100644
--- a/sys/amd64/amd64/vm_machdep.c
+++ b/sys/amd64/amd64/vm_machdep.c
@@ -160,6 +160,10 @@ cpu_fork(p1, p2, flags)
((int)p2->p_addr + UPAGES * PAGE_SIZE - 16) - 1;
bcopy(p1->p_md.md_regs, p2->p_md.md_regs, sizeof(*p2->p_md.md_regs));
+ p2->p_md.md_regs->tf_eax = 0; /* Child returns zero */
+ p2->p_md.md_regs->tf_eflags &= ~PSL_C; /* success */
+ p2->p_md.md_regs->tf_edx = 1;
+
/*
* Set registers for trampoline to user mode. Leave space for the
* return address on stack. These are the kernel mode register values.
diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c
index 22625b2..232ac42 100644
--- a/sys/i386/i386/vm_machdep.c
+++ b/sys/i386/i386/vm_machdep.c
@@ -160,6 +160,10 @@ cpu_fork(p1, p2, flags)
((int)p2->p_addr + UPAGES * PAGE_SIZE - 16) - 1;
bcopy(p1->p_md.md_regs, p2->p_md.md_regs, sizeof(*p2->p_md.md_regs));
+ p2->p_md.md_regs->tf_eax = 0; /* Child returns zero */
+ p2->p_md.md_regs->tf_eflags &= ~PSL_C; /* success */
+ p2->p_md.md_regs->tf_edx = 1;
+
/*
* Set registers for trampoline to user mode. Leave space for the
* return address on stack. These are the kernel mode register values.
OpenPOWER on IntegriCloud