diff --git a/sys/arch/sparc64/sparc64/compat_13_machdep.c b/sys/arch/sparc64/sparc64/compat_13_machdep.c index 2d844d0fed99..6f46bc9e96df 100644 --- a/sys/arch/sparc64/sparc64/compat_13_machdep.c +++ b/sys/arch/sparc64/sparc64/compat_13_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: compat_13_machdep.c,v 1.2 1998/10/08 02:31:40 eeh Exp $ */ +/* $NetBSD: compat_13_machdep.c,v 1.3 1998/11/16 06:51:35 eeh Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -91,7 +91,14 @@ compat_13_sys_sigreturn(p, v, retval) * verified. pc and npc must be multiples of 4. This is all * that is required; if it holds, just do it. */ - if (((scp->sc_pc | scp->sc_npc) & 3) != 0) + if (((scp->sc_pc | scp->sc_npc) & 3) != 0 || scp->sc_pc == 0 || scp->sc_npc == 0) +#ifdef DEBUG + { + printf("sigreturn13: pc %p or npc %p invalid\n", scp->sc_pc, scp->sc_npc); + Debugger(); + return (EINVAL); + } +#endif return (EINVAL); /* take only psr ICC field */ #ifdef _LP64 diff --git a/sys/arch/sparc64/sparc64/locore.s b/sys/arch/sparc64/sparc64/locore.s index 7e19f67b6d22..42e989c0c49e 100644 --- a/sys/arch/sparc64/sparc64/locore.s +++ b/sys/arch/sparc64/sparc64/locore.s @@ -3936,10 +3936,10 @@ zshard: */ return_from_trap: #ifdef DEBUG - !! Make sure we don't have pc == npc or we suck. + !! Make sure we don't have pc == npc == 0 or we suck. ldx [%sp + CC64FSZ + STKB + TF_PC], %g2 ldx [%sp + CC64FSZ + STKB + TF_NPC], %g3 - cmp %g2, %g3 + orcc %g2, %g3, %g0 tz %icc, 1 #endif #ifdef NOTDEF_DEBUG diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c index f161fbb99f0c..0453c9e1b9e6 100644 --- a/sys/arch/sparc64/sparc64/machdep.c +++ b/sys/arch/sparc64/sparc64/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.21 1998/10/19 22:09:20 tron Exp $ */ +/* $NetBSD: machdep.c,v 1.22 1998/11/16 06:51:36 eeh Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -645,7 +645,7 @@ sendsig(catcher, sig, mask, code) /* * Build the signal context to be used by sigreturn. */ - sf.sf_sc.sc_onstack = onstack; + sf.sf_sc.sc_onstack = psp->ps_sigstk.ss_flags & SS_ONSTACK; sf.sf_sc.sc_mask = *mask; #ifdef COMPAT_13 /* @@ -674,7 +674,7 @@ sendsig(catcher, sig, mask, code) * joins seamlessly with the frame it was in when the signal occurred, * so that the debugger and _longjmp code can back up through it. */ - newsp = (struct rwindow *)((vaddr_t)fp - CC64FSZ); + newsp = (struct rwindow *)((vaddr_t)fp - sizeof(struct rwindow)); write_user_windows(); #ifdef DEBUG if ((sigdebug & SDB_KSTACK)) @@ -794,10 +794,10 @@ sys___sigreturn14(p, v, retval) * verified. pc and npc must be multiples of 4. This is all * that is required; if it holds, just do it. */ - if (((sc.sc_pc | sc.sc_npc) & 3) != 0) + if (((sc.sc_pc | sc.sc_npc) & 3) != 0 || (sc.sc_pc == 0) || (sc.sc_npc == 0)) #ifdef DEBUG { - printf("sigreturn: pc %p or npc %p invalid\n", sc.sc_pc, sc.sc_npc); + printf("sigreturn14: pc %p or npc %p invalid\n", sc.sc_pc, sc.sc_npc); Debugger(); return (EINVAL); } diff --git a/sys/arch/sparc64/sparc64/sunos_machdep.c b/sys/arch/sparc64/sparc64/sunos_machdep.c index fcf6e6a39207..b7c320f1a83f 100644 --- a/sys/arch/sparc64/sparc64/sunos_machdep.c +++ b/sys/arch/sparc64/sparc64/sunos_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunos_machdep.c,v 1.4 1998/10/08 02:31:41 eeh Exp $ */ +/* $NetBSD: sunos_machdep.c,v 1.5 1998/11/16 06:51:36 eeh Exp $ */ /* * Copyright (c) 1995 Matthew R. Green @@ -237,7 +237,14 @@ sunos_sys_sigreturn(p, v, retval) * verified. pc and npc must be multiples of 4. This is all * that is required; if it holds, just do it. */ - if (((scp->sc_pc | scp->sc_npc) & 3) != 0) + if (((scp->sc_pc | scp->sc_npc) & 3) != 0 || scp->sc_pc == 0 || scp->sc_npc == 0) +#ifdef DEBUG + { + printf("sigreturn13: pc %p or npc %p invalid\n", scp->sc_pc, scp->sc_npc); + Debugger(); + return (EINVAL); + } +#endif return (EINVAL); /* take only psr ICC field */ tf->tf_tstate = (int64_t)(tf->tf_tstate & ~TSTATE_CCR) | PSRCC_TO_TSTATE(scp->sc_psr);