summaryrefslogtreecommitdiffstats
path: root/sys/sparc64
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2005-04-14 18:30:10 +0000
committerjhb <jhb@FreeBSD.org>2005-04-14 18:30:10 +0000
commitb5018d26b543bfdf6b19a0a07c1dce2afd64a742 (patch)
tree29781ffc2f1a9c80d7799b7fec4d21ffd821d7c4 /sys/sparc64
parent15966b504157990ac9b6a28bc69bdd1c536f41df (diff)
downloadFreeBSD-src-b5018d26b543bfdf6b19a0a07c1dce2afd64a742.zip
FreeBSD-src-b5018d26b543bfdf6b19a0a07c1dce2afd64a742.tar.gz
Close a race I introduced in the spinlock_* changes. We need to finish
disabling interrupts before updating the saved pil in the thread. If we save the value first then it can be clobbered if an interrupt comes in and the interrupt handler tries to acquire a spin lock. Submitted by: marius
Diffstat (limited to 'sys/sparc64')
-rw-r--r--sys/sparc64/sparc64/machdep.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/sparc64/sparc64/machdep.c b/sys/sparc64/sparc64/machdep.c
index ccad878..a91f809 100644
--- a/sys/sparc64/sparc64/machdep.c
+++ b/sys/sparc64/sparc64/machdep.c
@@ -236,11 +236,13 @@ void
spinlock_enter(void)
{
struct thread *td;
+ register_t pil;
td = curthread;
if (td->td_md.md_spinlock_count == 0) {
- td->td_md.md_saved_pil = rdpr(pil);
+ pil = rdpr(pil);
wrpr(pil, 0, 14);
+ td->td_md.md_saved_pil = pil;
}
td->td_md.md_spinlock_count++;
critical_enter();
OpenPOWER on IntegriCloud