diff options
author | rtm <rtm> | 2006-08-10 02:07:10 +0000 |
---|---|---|
committer | rtm <rtm> | 2006-08-10 02:07:10 +0000 |
commit | 8a8be1b8c36e38f58f8ba3e425b6e701ad65abf3 (patch) | |
tree | 8e04f2b39be9be0a06e2b14c2b24ed7328766c7e /spinlock.c | |
parent | 28d9ef04ddaa4cf32f3c63c976afdc535a36db98 (diff) | |
download | xv6-labs-8a8be1b8c36e38f58f8ba3e425b6e701ad65abf3.tar.gz xv6-labs-8a8be1b8c36e38f58f8ba3e425b6e701ad65abf3.tar.bz2 xv6-labs-8a8be1b8c36e38f58f8ba3e425b6e701ad65abf3.zip |
low-level keyboard input (not hooked up to /dev yet)
fix acquire() to cli() *before* incrementing nlock
make T_SYSCALL a trap gate, not an interrupt gate
sadly, various crashes if you hold down a keyboard key...
Diffstat (limited to 'spinlock.c')
-rw-r--r-- | spinlock.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -30,8 +30,10 @@ acquire(struct spinlock * lock) if(holding(lock)) panic("acquire"); - if(cpus[cpu()].nlock++ == 0) - cli(); + if(cpus[cpu()].nlock == 0) + cli(); + cpus[cpu()].nlock++; + while(cmpxchg(0, 1, &lock->locked) == 1) ; cpuid(0, 0, 0, 0, 0); // memory barrier @@ -53,6 +55,8 @@ release(struct spinlock * lock) lock->locked = 0; if(--cpus[cpu()].nlock == 0) sti(); + // xxx we may have just turned interrupts on during + // an interrupt, is that ok? } int |