diff options
author | Philip Guenthe <guenther@cvs.openbsd.org> | 2011-07-11 15:40:48 +0000 |
---|---|---|
committer | Philip Guenthe <guenther@cvs.openbsd.org> | 2011-07-11 15:40:48 +0000 |
commit | 9d36a78df6815757d9e70d30a2c86159ecc0a7a7 (patch) | |
tree | 95784ef05743f932548f12cb7a59e5d59dde8d4d /sys/arch/sparc64 | |
parent | 4f69e977bd7d4a9b7d8480fa58774ca13beac905 (diff) |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls,
as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r-- | sys/arch/sparc64/fpu/fpu.c | 10 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/emul.c | 10 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/trap.c | 48 |
3 files changed, 65 insertions, 3 deletions
diff --git a/sys/arch/sparc64/fpu/fpu.c b/sys/arch/sparc64/fpu/fpu.c index 82ecd01693f..c82af1be713 100644 --- a/sys/arch/sparc64/fpu/fpu.c +++ b/sys/arch/sparc64/fpu/fpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fpu.c,v 1.16 2011/07/07 18:11:24 art Exp $ */ +/* $OpenBSD: fpu.c,v 1.17 2011/07/11 15:40:47 guenther Exp $ */ /* $NetBSD: fpu.c,v 1.11 2000/12/06 01:47:50 mrg Exp $ */ /* @@ -214,7 +214,9 @@ fpu_cleanup(p, fs) case FSR_TT_IEEE: if ((i = fsr & FSR_CX) == 0) panic("fpu ieee trap, but no exception"); + KERNEL_LOCK(); trapsignal(p, SIGFPE, fpu_codes[i - 1], fpu_types[i - 1], sv); + KERNEL_UNLOCK(); break; /* XXX should return, but queue remains */ case FSR_TT_UNFIN: @@ -237,7 +239,9 @@ fpu_cleanup(p, fs) log(LOG_ERR, "fpu hardware error (%s[%d])\n", p->p_comm, p->p_pid); uprintf("%s[%d]: fpu hardware error\n", p->p_comm, p->p_pid); + KERNEL_LOCK(); trapsignal(p, SIGFPE, -1, FPE_FLTINV, sv); /* ??? */ + KERNEL_UNLOCK(); goto out; default: @@ -260,13 +264,17 @@ fpu_cleanup(p, fs) continue; case FPE: + KERNEL_LOCK(); trapsignal(p, SIGFPE, fpu_codes[(fs->fs_fsr & FSR_CX) - 1], fpu_types[(fs->fs_fsr & FSR_CX) - 1], sv); + KERNEL_UNLOCK(); break; case NOTFPU: + KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_COPROC, sv); + KERNEL_UNLOCK(); break; default: diff --git a/sys/arch/sparc64/sparc64/emul.c b/sys/arch/sparc64/sparc64/emul.c index d83f2737586..3cd9f33faa2 100644 --- a/sys/arch/sparc64/sparc64/emul.c +++ b/sys/arch/sparc64/sparc64/emul.c @@ -1,4 +1,4 @@ -/* $OpenBSD: emul.c,v 1.21 2011/07/07 18:11:24 art Exp $ */ +/* $OpenBSD: emul.c,v 1.22 2011/07/11 15:40:47 guenther Exp $ */ /* $NetBSD: emul.c,v 1.8 2001/06/29 23:58:40 eeh Exp $ */ /*- @@ -333,7 +333,9 @@ emul_qf(int32_t insv, struct proc *p, union sigval sv, struct trapframe *tf) if (asi < ASI_PRIMARY) { /* privileged asi */ + KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_PRVOPC, sv); + KERNEL_UNLOCK(); return (0); } if (asi > ASI_SECONDARY_NOFAULT_LITTLE || @@ -344,13 +346,17 @@ emul_qf(int32_t insv, struct proc *p, union sigval sv, struct trapframe *tf) if ((freg & 3) != 0) { /* only valid for %fN where N % 4 = 0 */ + KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_ILLOPN, sv); + KERNEL_UNLOCK(); return (0); } if ((addr & 3) != 0) { /* request is not aligned */ + KERNEL_LOCK(); trapsignal(p, SIGBUS, 0, BUS_ADRALN, sv); + KERNEL_UNLOCK(); return (0); } @@ -387,8 +393,10 @@ emul_qf(int32_t insv, struct proc *p, union sigval sv, struct trapframe *tf) return (1); segv: + KERNEL_LOCK(); trapsignal(p, SIGSEGV, isload ? VM_PROT_READ : VM_PROT_WRITE, SEGV_MAPERR, sv); + KERNEL_UNLOCK(); return (0); } diff --git a/sys/arch/sparc64/sparc64/trap.c b/sys/arch/sparc64/sparc64/trap.c index 2c1dbce8386..29fd687123b 100644 --- a/sys/arch/sparc64/sparc64/trap.c +++ b/sys/arch/sparc64/sparc64/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.72 2011/07/07 18:11:24 art Exp $ */ +/* $OpenBSD: trap.c,v 1.73 2011/07/11 15:40:47 guenther Exp $ */ /* $NetBSD: trap.c,v 1.73 2001/08/09 01:03:01 eeh Exp $ */ /* @@ -466,13 +466,17 @@ dopanic: pc, (long)tf->tf_npc, pstate, PSTATE_BITS); /* NOTREACHED */ } + KERNEL_LOCK(); trapsignal(p, SIGILL, type, ILL_ILLOPC, sv); + KERNEL_UNLOCK(); break; case T_AST: p->p_md.md_astpending = 0; if (p->p_flag & P_OWEUPC) { + KERNEL_LOCK(); ADDUPROF(p); + KERNEL_UNLOCK(); } if (curcpu()->ci_want_resched) preempt(NULL); @@ -489,7 +493,9 @@ dopanic: */ write_user_windows(); if (rwindow_save(p) == -1) { + KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_BADSTK, sv); + KERNEL_UNLOCK(); } break; @@ -499,7 +505,9 @@ dopanic: if (copyin((caddr_t)pc, &ins, sizeof(ins)) != 0) { /* XXX Can this happen? */ + KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_ILLOPC, sv); + KERNEL_UNLOCK(); break; } if (ins.i_any.i_op == IOP_mem && @@ -518,7 +526,9 @@ dopanic: ADVANCE; break; } + KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_ILLOPC, sv); /* XXX code? */ + KERNEL_UNLOCK(); break; } @@ -526,7 +536,9 @@ dopanic: case T_TEXTFAULT: case T_PRIVINST: case T_PRIVACT: + KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_ILLOPC, sv); /* XXX code? */ + KERNEL_UNLOCK(); break; case T_FPDISABLED: { @@ -577,7 +589,9 @@ dopanic: if (copyin((caddr_t)pc, &ins, sizeof(ins)) != 0) { /* XXX Can this happen? */ + KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_ILLOPC, sv); + KERNEL_UNLOCK(); break; } if (ins.i_any.i_op == IOP_mem && @@ -588,7 +602,9 @@ dopanic: if (emul_qf(ins.i_int, p, sv, tf)) ADVANCE; } else { + KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_ILLOPC, sv); + KERNEL_UNLOCK(); } break; } @@ -631,7 +647,9 @@ dopanic: } /* XXX sv.sival_ptr should be the fault address! */ + KERNEL_LOCK(); trapsignal(p, SIGBUS, 0, BUS_ADRALN, sv); /* XXX code? */ + KERNEL_UNLOCK(); break; case T_FP_IEEE_754: @@ -666,16 +684,22 @@ dopanic: break; case T_TAGOF: + KERNEL_LOCK(); trapsignal(p, SIGEMT, 0, EMT_TAGOVF, sv); /* XXX code? */ + KERNEL_UNLOCK(); break; case T_BREAKPOINT: + KERNEL_LOCK(); trapsignal(p, SIGTRAP, 0, TRAP_BRKPT, sv); + KERNEL_UNLOCK(); break; case T_DIV0: ADVANCE; + KERNEL_LOCK(); trapsignal(p, SIGFPE, 0, FPE_INTDIV, sv); + KERNEL_UNLOCK(); break; case T_CLEANWIN: @@ -691,19 +715,25 @@ dopanic: case T_RANGECHECK: ADVANCE; + KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_ILLOPN, sv); /* XXX code? */ + KERNEL_UNLOCK(); break; case T_FIXALIGN: uprintf("T_FIXALIGN\n"); ADVANCE; + KERNEL_LOCK(); trapsignal(p, SIGILL, 0, ILL_ILLOPN, sv); /* XXX code? */ + KERNEL_UNLOCK(); break; case T_INTOF: uprintf("T_INTOF\n"); /* XXX */ ADVANCE; + KERNEL_LOCK(); trapsignal(p, SIGFPE, FPE_INTOVF_TRAP, FPE_INTOVF, sv); + KERNEL_UNLOCK(); break; } userret(p); @@ -971,7 +1001,9 @@ data_access_error(tf, type, afva, afsr, sfva, sfsr) return; } + KERNEL_LOCK(); trapsignal(p, SIGSEGV, VM_PROT_READ|VM_PROT_WRITE, SEGV_MAPERR, sv); + KERNEL_UNLOCK(); out: if ((tstate & TSTATE_PRIV) == 0) { @@ -1108,7 +1140,9 @@ text_access_error(tf, type, pc, sfsr, afva, afsr) panic("text_access_error: kernel memory error"); /* User fault -- Berr */ + KERNEL_LOCK(); trapsignal(p, SIGBUS, 0, BUS_ADRALN, sv); + KERNEL_UNLOCK(); } if ((sfsr & SFSR_FV) == 0 || (sfsr & SFSR_FT) == 0) @@ -1292,7 +1326,9 @@ syscall(tf, code, pc) #ifdef KTRACE if (KTRPOINT(p, KTR_SYSCALL)) { + KERNEL_LOCK(); ktrsyscall(p, code, callp->sy_argsize, args); + KERNEL_UNLOCK(); } #endif if (error) @@ -1303,13 +1339,17 @@ syscall(tf, code, pc) } #ifdef SYSCALL_DEBUG + KERNEL_LOCK(); scdebug_call(p, code, args); + KERNEL_UNLOCK(); #endif rval[0] = 0; rval[1] = tf->tf_out[1]; #if NSYSTRACE > 0 if (ISSET(p->p_flag, P_SYSTRACE)) { + KERNEL_LOCK(); error = systrace_redirect(code, p, args, rval); + KERNEL_UNLOCK(); } else #endif { @@ -1359,12 +1399,16 @@ syscall(tf, code, pc) } #ifdef SYSCALL_DEBUG + KERNEL_LOCK(); scdebug_ret(p, code, error, rval); + KERNEL_UNLOCK(); #endif userret(p); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) { + KERNEL_LOCK(); ktrsysret(p, code, error, rval[0]); + KERNEL_UNLOCK(); } #endif share_fpu(p, tf); @@ -1392,10 +1436,12 @@ child_return(arg) userret(p); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) { + KERNEL_LOCK(); ktrsysret(p, (p->p_flag & P_THREAD) ? SYS_rfork : (p->p_p->ps_flags & PS_PPWAIT) ? SYS_vfork : SYS_fork, 0, 0); + KERNEL_UNLOCK(); } #endif } |