summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2005-08-08 19:48:38 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2005-08-08 19:48:38 +0000
commit03cd64efdc23904de693c055bd99ca9996b623b4 (patch)
tree495b74eec42d7d3dcdfd85d84a3a0a912faceae0 /sys
parent640aa8c942d34b8bff599f54cc8843d81e105e4c (diff)
Skip (trap) instruction in cpu_fork() instead of proc_trampoline().
Fixes returning from fork(2) in the child with a pending signal. tested by otto@, krw@, sturm@ ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/sparc64/sparc64/locore.s6
-rw-r--r--sys/arch/sparc64/sparc64/vm_machdep.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/sys/arch/sparc64/sparc64/locore.s b/sys/arch/sparc64/sparc64/locore.s
index 914ce05eee0..49c659ea9e2 100644
--- a/sys/arch/sparc64/sparc64/locore.s
+++ b/sys/arch/sparc64/sparc64/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.51 2005/07/18 14:50:11 deraadt Exp $ */
+/* $OpenBSD: locore.s,v 1.52 2005/08/08 19:48:37 kettenis Exp $ */
/* $NetBSD: locore.s,v 1.137 2001/08/13 06:10:10 jdolecek Exp $ */
/*
@@ -6095,13 +6095,9 @@ ENTRY(proc_trampoline)
stx %g1, [%sp + CC64FSZ + BIAS + TF_TSTATE]
#else /* 0 */
mov PSTATE_USER, %g1 ! XXXX user pstate (no need to load it)
- ldx [%sp + CC64FSZ + BIAS + TF_NPC], %g2 ! pc = tf->tf_npc from execve/fork
sllx %g1, TSTATE_PSTATE_SHIFT, %g1 ! Shift it into place
- add %g2, 4, %g3 ! npc = pc+4
rdpr %cwp, %g5 ! Fixup %cwp in %tstate
- stx %g3, [%sp + CC64FSZ + BIAS + TF_NPC]
or %g1, %g5, %g1
- stx %g2, [%sp + CC64FSZ + BIAS + TF_PC]
stx %g1, [%sp + CC64FSZ + BIAS + TF_TSTATE]
#endif /* 0 */
CHKPT %o3,%o4,0x35
diff --git a/sys/arch/sparc64/sparc64/vm_machdep.c b/sys/arch/sparc64/sparc64/vm_machdep.c
index 0feadd45b6d..dc6ad0649a3 100644
--- a/sys/arch/sparc64/sparc64/vm_machdep.c
+++ b/sys/arch/sparc64/sparc64/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.11 2005/03/29 19:34:07 kettenis Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.12 2005/08/08 19:48:37 kettenis Exp $ */
/* $NetBSD: vm_machdep.c,v 1.38 2001/06/30 00:02:20 eeh Exp $ */
/*
@@ -302,6 +302,10 @@ cpu_fork(p1, p2, stack, stacksize, func, arg)
tf2->tf_out[0] = 0;
tf2->tf_out[1] = 1;
+ /* Skip trap instruction. */
+ tf2->tf_pc = tf2->tf_npc;
+ tf2->tf_npc += 4;
+
/* Construct kernel frame to return to in cpu_switch() */
rp = (struct rwindow *)((u_long)npcb + TOPFRAMEOFF);
*rp = *(struct rwindow *)((u_long)opcb + TOPFRAMEOFF);