summaryrefslogtreecommitdiff
path: root/sys/arch/amd64
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2011-07-11 15:40:48 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2011-07-11 15:40:48 +0000
commit9d36a78df6815757d9e70d30a2c86159ecc0a7a7 (patch)
tree95784ef05743f932548f12cb7a59e5d59dde8d4d /sys/arch/amd64
parent4f69e977bd7d4a9b7d8480fa58774ca13beac905 (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/amd64')
-rw-r--r--sys/arch/amd64/amd64/fpu.c4
-rw-r--r--sys/arch/amd64/amd64/syscall.c14
-rw-r--r--sys/arch/amd64/amd64/trap.c20
3 files changed, 35 insertions, 3 deletions
diff --git a/sys/arch/amd64/amd64/fpu.c b/sys/arch/amd64/amd64/fpu.c
index cb182aa1a22..779a713a398 100644
--- a/sys/arch/amd64/amd64/fpu.c
+++ b/sys/arch/amd64/amd64/fpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fpu.c,v 1.25 2011/07/10 18:09:27 deraadt Exp $ */
+/* $OpenBSD: fpu.c,v 1.26 2011/07/11 15:40:47 guenther Exp $ */
/* $NetBSD: fpu.c,v 1.1 2003/04/26 18:39:28 fvdl Exp $ */
/*-
@@ -160,7 +160,9 @@ fputrap(struct trapframe *frame)
sfp->fp_ex_sw = sfp->fp_fxsave.fx_fsw;
code = x86fpflags_to_siginfo (statbits);
sv.sival_ptr = (void *)frame->tf_rip; /* XXX - ? */
+ KERNEL_LOCK();
trapsignal(p, SIGFPE, frame->tf_err, code, sv);
+ KERNEL_UNLOCK();
}
static int
diff --git a/sys/arch/amd64/amd64/syscall.c b/sys/arch/amd64/amd64/syscall.c
index e8fa341ef92..c30b6dc1b4d 100644
--- a/sys/arch/amd64/amd64/syscall.c
+++ b/sys/arch/amd64/amd64/syscall.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.c,v 1.18 2011/07/07 18:11:23 art Exp $ */
+/* $OpenBSD: syscall.c,v 1.19 2011/07/11 15:40:47 guenther Exp $ */
/* $NetBSD: syscall.c,v 1.1 2003/04/26 18:39:32 fvdl Exp $ */
/*-
@@ -127,18 +127,24 @@ syscall(struct trapframe *frame)
lock = !(callp->sy_flags & SY_NOLOCK);
#ifdef SYSCALL_DEBUG
+ KERNEL_LOCK();
scdebug_call(p, code, argp);
+ KERNEL_UNLOCK();
#endif
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSCALL)) {
+ KERNEL_LOCK();
ktrsyscall(p, code, callp->sy_argsize, argp);
+ KERNEL_UNLOCK();
}
#endif
rval[0] = 0;
rval[1] = frame->tf_rdx;
#if NSYSTRACE > 0
if (ISSET(p->p_flag, P_SYSTRACE)) {
+ KERNEL_LOCK();
error = systrace_redirect(code, p, argp, rval);
+ KERNEL_UNLOCK();
} else
#endif
{
@@ -173,12 +179,16 @@ syscall(struct trapframe *frame)
}
#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
}
@@ -198,10 +208,12 @@ 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
}
diff --git a/sys/arch/amd64/amd64/trap.c b/sys/arch/amd64/amd64/trap.c
index ff2c2330724..e40c937b17c 100644
--- a/sys/arch/amd64/amd64/trap.c
+++ b/sys/arch/amd64/amd64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.24 2011/07/07 18:11:23 art Exp $ */
+/* $OpenBSD: trap.c,v 1.25 2011/07/11 15:40:47 guenther Exp $ */
/* $NetBSD: trap.c,v 1.2 2003/05/04 23:51:56 fvdl Exp $ */
/*-
@@ -250,16 +250,22 @@ copyfault:
frame_dump(frame);
#endif
sv.sival_ptr = (void *)frame->tf_rip;
+ KERNEL_LOCK();
trapsignal(p, SIGBUS, type & ~T_USER, BUS_OBJERR, sv);
+ KERNEL_UNLOCK();
goto out;
case T_ALIGNFLT|T_USER:
sv.sival_ptr = (void *)frame->tf_rip;
+ KERNEL_LOCK();
trapsignal(p, SIGBUS, type & ~T_USER, BUS_ADRALN, sv);
+ KERNEL_UNLOCK();
goto out;
case T_PRIVINFLT|T_USER: /* privileged instruction fault */
sv.sival_ptr = (void *)frame->tf_rip;
+ KERNEL_LOCK();
trapsignal(p, SIGILL, type & ~T_USER, ILL_PRVOPC, sv);
+ KERNEL_UNLOCK();
goto out;
case T_FPOPFLT|T_USER: /* coprocessor operand fault */
#ifdef TRAP_SIGDEBUG
@@ -268,13 +274,17 @@ copyfault:
frame_dump(frame);
#endif
sv.sival_ptr = (void *)frame->tf_rip;
+ KERNEL_LOCK();
trapsignal(p, SIGILL, type & ~T_USER, ILL_COPROC, sv);
+ KERNEL_UNLOCK();
goto out;
case T_ASTFLT|T_USER: /* Allow process switch */
uvmexp.softs++;
if (p->p_flag & P_OWEUPC) {
+ KERNEL_LOCK();
ADDUPROF(p);
+ KERNEL_UNLOCK();
}
/* Allow a forced task switch. */
if (curcpu()->ci_want_resched)
@@ -283,15 +293,21 @@ copyfault:
case T_BOUND|T_USER:
sv.sival_ptr = (void *)frame->tf_rip;
+ KERNEL_LOCK();
trapsignal(p, SIGFPE, type &~ T_USER, FPE_FLTSUB, sv);
+ KERNEL_UNLOCK();
goto out;
case T_OFLOW|T_USER:
sv.sival_ptr = (void *)frame->tf_rip;
+ KERNEL_LOCK();
trapsignal(p, SIGFPE, type &~ T_USER, FPE_INTOVF, sv);
+ KERNEL_UNLOCK();
goto out;
case T_DIVIDE|T_USER:
sv.sival_ptr = (void *)frame->tf_rip;
+ KERNEL_LOCK();
trapsignal(p, SIGFPE, type &~ T_USER, FPE_INTDIV, sv);
+ KERNEL_UNLOCK();
goto out;
case T_ARITHTRAP|T_USER:
@@ -405,7 +421,9 @@ faultcommon:
#ifdef MATH_EMULATE
trace:
#endif
+ KERNEL_LOCK();
trapsignal(p, SIGTRAP, type &~ T_USER, TRAP_BRKPT, sv);
+ KERNEL_UNLOCK();
break;
#if NISA > 0