From f7cea12b38a86e9b37fa5bc635310d3f85e5f8db Mon Sep 17 00:00:00 2001 From: kaashoek <kaashoek> Date: Wed, 28 Jun 2006 16:44:41 +0000 Subject: disable interrupts when holding kernel lock --- spinlock.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'spinlock.c') diff --git a/spinlock.c b/spinlock.c index 911ecf8..5cbe062 100644 --- a/spinlock.c +++ b/spinlock.c @@ -14,6 +14,8 @@ acquire_spinlock(uint32_t* lock) if (*lock == cpu_id) return; + + lapic_disableintr(); while ( cmpxchg(LOCK_FREE, cpu_id, lock) != cpu_id ) { ; } // cprintf ("acquired: %d\n", cpu_id); } @@ -26,6 +28,7 @@ release_spinlock(uint32_t* lock) if (*lock != cpu_id) panic("release_spinlock: releasing a lock that i don't own\n"); *lock = LOCK_FREE; + lapic_enableintr(); } void -- cgit v1.2.3