diff options
Diffstat (limited to 'sys/mips/mips/machdep.c')
-rw-r--r-- | sys/mips/mips/machdep.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/mips/mips/machdep.c b/sys/mips/mips/machdep.c index 435b9b4..314bfd1 100644 --- a/sys/mips/mips/machdep.c +++ b/sys/mips/mips/machdep.c @@ -450,11 +450,15 @@ void spinlock_enter(void) { struct thread *td; + register_t intr; td = curthread; - if (td->td_md.md_spinlock_count == 0) - td->td_md.md_saved_intr = intr_disable(); - td->td_md.md_spinlock_count++; + if (td->td_md.md_spinlock_count == 0) { + intr = intr_disable(); + td->td_md.md_spinlock_count = 1; + td->td_md.md_saved_intr = intr; + } else + td->td_md.md_spinlock_count++; critical_enter(); } @@ -462,12 +466,14 @@ void spinlock_exit(void) { struct thread *td; + register_t intr; td = curthread; critical_exit(); + intr = td->td_md.md_saved_intr; td->td_md.md_spinlock_count--; if (td->td_md.md_spinlock_count == 0) - intr_restore(td->td_md.md_saved_intr); + intr_restore(intr); } /* |