summaryrefslogtreecommitdiff
path: root/sys/arch/hppa
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2011-07-07 18:11:25 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2011-07-07 18:11:25 +0000
commitf0dbc508cb2d1060a83c43da71f60ac4bab02188 (patch)
tree260e73ca64d22b10f4541858e6ee7fea0b7c1bff /sys/arch/hppa
parent291e013ccd4b9989e6d79d1ae219784a4a37894e (diff)
There is a bunch of places in the kernel entry points where we don't
hold the kernel lock, but still need call one function that needs it. Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse. kettenis@, beck@ ok
Diffstat (limited to 'sys/arch/hppa')
-rw-r--r--sys/arch/hppa/hppa/trap.c46
1 files changed, 1 insertions, 45 deletions
diff --git a/sys/arch/hppa/hppa/trap.c b/sys/arch/hppa/hppa/trap.c
index 54dd8f20977..8a807ab25b8 100644
--- a/sys/arch/hppa/hppa/trap.c
+++ b/sys/arch/hppa/hppa/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.116 2011/07/06 21:41:37 art Exp $ */
+/* $OpenBSD: trap.c,v 1.117 2011/07/07 18:11:23 art Exp $ */
/*
* Copyright (c) 1998-2004 Michael Shalayeff
@@ -146,9 +146,7 @@ userret(struct proc *p)
p->p_md.md_astpending = 0;
uvmexp.softs++;
if (p->p_flag & P_OWEUPC) {
- KERNEL_LOCK();
ADDUPROF(p);
- KERNEL_UNLOCK();
}
if (curcpu()->ci_want_resched)
preempt(NULL);
@@ -282,9 +280,7 @@ trap(int type, struct trapframe *frame)
code = TRAP_TRACE;
#endif
/* pass to user debugger */
- KERNEL_LOCK();
trapsignal(p, SIGTRAP, type &~ T_USER, code, sv);
- KERNEL_UNLOCK();
}
break;
@@ -293,9 +289,7 @@ trap(int type, struct trapframe *frame)
ss_clear_breakpoints(p);
/* pass to user debugger */
- KERNEL_LOCK();
trapsignal(p, SIGTRAP, type &~ T_USER, TRAP_TRACE, sv);
- KERNEL_UNLOCK();
break;
#endif
@@ -335,9 +329,7 @@ trap(int type, struct trapframe *frame)
fpp[0] &= ~(((u_int64_t)HPPA_FPU_T) << 32);
sv.sival_int = va;
- KERNEL_LOCK();
trapsignal(p, SIGFPE, type &~ T_USER, flt, sv);
- KERNEL_UNLOCK();
}
break;
@@ -347,46 +339,34 @@ trap(int type, struct trapframe *frame)
case T_EMULATION | T_USER:
sv.sival_int = va;
- KERNEL_LOCK();
trapsignal(p, SIGILL, type &~ T_USER, ILL_COPROC, sv);
- KERNEL_UNLOCK();
break;
case T_OVERFLOW | T_USER:
sv.sival_int = va;
- KERNEL_LOCK();
trapsignal(p, SIGFPE, type &~ T_USER, FPE_INTOVF, sv);
- KERNEL_UNLOCK();
break;
case T_CONDITION | T_USER:
sv.sival_int = va;
- KERNEL_LOCK();
trapsignal(p, SIGFPE, type &~ T_USER, FPE_INTDIV, sv);
- KERNEL_UNLOCK();
break;
case T_PRIV_OP | T_USER:
sv.sival_int = va;
- KERNEL_LOCK();
trapsignal(p, SIGILL, type &~ T_USER, ILL_PRVOPC, sv);
- KERNEL_UNLOCK();
break;
case T_PRIV_REG | T_USER:
sv.sival_int = va;
- KERNEL_LOCK();
trapsignal(p, SIGILL, type &~ T_USER, ILL_PRVREG, sv);
- KERNEL_UNLOCK();
break;
/* these should never got here */
case T_HIGHERPL | T_USER:
case T_LOWERPL | T_USER:
sv.sival_int = va;
- KERNEL_LOCK();
trapsignal(p, SIGSEGV, vftype, SEGV_ACCERR, sv);
- KERNEL_UNLOCK();
break;
/*
@@ -405,9 +385,7 @@ trap(int type, struct trapframe *frame)
case T_IPROT | T_USER:
sv.sival_int = va;
- KERNEL_LOCK();
trapsignal(p, SIGSEGV, vftype, SEGV_ACCERR, sv);
- KERNEL_UNLOCK();
break;
case T_ITLBMISSNA:
@@ -449,9 +427,7 @@ trap(int type, struct trapframe *frame)
KERNEL_UNLOCK();
} else if (type & T_USER) {
sv.sival_int = va;
- KERNEL_LOCK();
trapsignal(p, SIGILL, type & ~T_USER, ILL_ILLTRP, sv);
- KERNEL_UNLOCK();
} else
panic("trap: %s @ 0x%x:0x%x for 0x%x:0x%x irr 0x%08x",
tts, frame->tf_iisq_head, frame->tf_iioq_head,
@@ -489,9 +465,7 @@ datacc:
if ((type & T_USER && va >= VM_MAXUSER_ADDRESS) ||
(type & T_USER && map->pmap->pm_space != space)) {
sv.sival_int = va;
- KERNEL_LOCK();
trapsignal(p, SIGSEGV, vftype, SEGV_MAPERR, sv);
- KERNEL_UNLOCK();
break;
}
@@ -519,11 +493,9 @@ datacc:
if (ret != 0) {
if (type & T_USER) {
sv.sival_int = va;
- KERNEL_LOCK();
trapsignal(p, SIGSEGV, vftype,
ret == EACCES? SEGV_ACCERR : SEGV_MAPERR,
sv);
- KERNEL_UNLOCK();
} else {
if (p && p->p_addr->u_pcb.pcb_onfault) {
frame->tf_iioq_tail = 4 +
@@ -544,9 +516,7 @@ datacc:
case T_DATALIGN | T_USER:
datalign_user:
sv.sival_int = va;
- KERNEL_LOCK();
trapsignal(p, SIGBUS, vftype, BUS_ADRALN, sv);
- KERNEL_UNLOCK();
break;
case T_INTERRUPT:
@@ -568,9 +538,7 @@ datalign_user:
}
if (type & T_USER) {
sv.sival_int = va;
- KERNEL_LOCK();
trapsignal(p, SIGILL, type &~ T_USER, ILL_ILLOPC, sv);
- KERNEL_UNLOCK();
break;
}
/* FALLTHROUGH */
@@ -646,12 +614,10 @@ child_return(void *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
}
@@ -869,15 +835,11 @@ syscall(struct trapframe *frame)
}
#ifdef SYSCALL_DEBUG
- KERNEL_LOCK();
scdebug_call(p, code, args);
- KERNEL_UNLOCK();
#endif
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSCALL)) {
- KERNEL_LOCK();
ktrsyscall(p, code, callp->sy_argsize, args);
- KERNEL_UNLOCK();
}
#endif
if (error)
@@ -887,9 +849,7 @@ syscall(struct trapframe *frame)
rval[1] = frame->tf_ret1;
#if NSYSTRACE > 0
if (ISSET(p->p_flag, P_SYSTRACE)) {
- KERNEL_LOCK();
oerror = error = systrace_redirect(code, p, args, rval);
- KERNEL_UNLOCK();
} else
#endif
{
@@ -922,16 +882,12 @@ syscall(struct trapframe *frame)
break;
}
#ifdef SYSCALL_DEBUG
- KERNEL_LOCK();
scdebug_ret(p, code, oerror, rval);
- KERNEL_UNLOCK();
#endif
userret(p);
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSRET)) {
- KERNEL_LOCK();
ktrsysret(p, code, oerror, rval[0]);
- KERNEL_UNLOCK();
}
#endif
#ifdef DIAGNOSTIC