summaryrefslogtreecommitdiff
path: root/spinlock.c
diff options
context:
space:
mode:
authorFrans Kaashoek <[email protected]>2016-09-08 21:20:26 -0400
committerFrans Kaashoek <[email protected]>2016-09-08 21:20:26 -0400
commit551c2f3576d34e4749a1165af07d90e21ad528be (patch)
tree7fac220585c88fcb568bc8c656e0532b033fec9b /spinlock.c
parent1b8ccf9482facb15f905a6baca4f5d800a13c542 (diff)
parent34c2efc1d063f4b366c1017c174d117cc96eb990 (diff)
downloadxv6-labs-551c2f3576d34e4749a1165af07d90e21ad528be.tar.gz
xv6-labs-551c2f3576d34e4749a1165af07d90e21ad528be.tar.bz2
xv6-labs-551c2f3576d34e4749a1165af07d90e21ad528be.zip
Merge branch 'master' of g.csail.mit.edu:xv6-dev
Diffstat (limited to 'spinlock.c')
-rw-r--r--spinlock.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/spinlock.c b/spinlock.c
index bf863ef..7b372ef 100644
--- a/spinlock.c
+++ b/spinlock.c
@@ -59,8 +59,10 @@ release(struct spinlock *lk)
// stores; __sync_synchronize() tells them both to not re-order.
__sync_synchronize();
- // Release the lock.
- lk->locked = 0;
+ // Release the lock, equivalent to lk->locked = 0.
+ // This code can't use a C assignment, since it might
+ // not be atomic.
+ asm volatile("movl $0, %0" : "+m" (lk->locked) : );
popcli();
}