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
This commit is contained in:
John Baldwin 2005-04-14 18:30:10 +00:00
parent e897c4d6fb
commit 5d971d4895

View File

@ -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();