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:
jhb 2005-04-14 18:30:10 +00:00
parent 15966b5041
commit b5018d26b5

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