summaryrefslogtreecommitdiff
path: root/spinlock.c
diff options
context:
space:
mode:
Diffstat (limited to 'spinlock.c')
-rw-r--r--spinlock.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/spinlock.c b/spinlock.c
index 942d93d..9120bf2 100644
--- a/spinlock.c
+++ b/spinlock.c
@@ -38,7 +38,7 @@ acquire(struct spinlock *lk)
__sync_synchronize();
// Record info about lock acquisition for debugging.
- lk->cpu = cpu;
+ lk->cpu = mycpu();
getcallerpcs(&lk, lk->pcs);
}
@@ -89,7 +89,7 @@ getcallerpcs(void *v, uint pcs[])
int
holding(struct spinlock *lock)
{
- return lock->locked && lock->cpu == cpu;
+ return lock->locked && lock->cpu == mycpu();
}
@@ -104,9 +104,9 @@ pushcli(void)
eflags = readeflags();
cli();
- if(cpu->ncli == 0)
- cpu->intena = eflags & FL_IF;
- cpu->ncli += 1;
+ if(mycpu()->ncli == 0)
+ mycpu()->intena = eflags & FL_IF;
+ mycpu()->ncli += 1;
}
void
@@ -114,9 +114,9 @@ popcli(void)
{
if(readeflags()&FL_IF)
panic("popcli - interruptible");
- if(--cpu->ncli < 0)
+ if(--mycpu()->ncli < 0)
panic("popcli");
- if(cpu->ncli == 0 && cpu->intena)
+ if(mycpu()->ncli == 0 && mycpu()->intena)
sti();
}