diff options
author | Frans Kaashoek <[email protected]> | 2017-01-31 17:47:16 -0500 |
---|---|---|
committer | Frans Kaashoek <[email protected]> | 2017-01-31 17:47:16 -0500 |
commit | abf847a083888bbed4260ecacf849ea19f23e810 (patch) | |
tree | 4ae9b3487bbfe27f6382486bf877917dbb8bc030 /spinlock.c | |
parent | 59cdd6c63b89395d64ec9550181af5ed569b8466 (diff) | |
download | xv6-labs-abf847a083888bbed4260ecacf849ea19f23e810.tar.gz xv6-labs-abf847a083888bbed4260ecacf849ea19f23e810.tar.bz2 xv6-labs-abf847a083888bbed4260ecacf849ea19f23e810.zip |
Start of an experiment to remove the use of gs for cpu local variables.
Diffstat (limited to 'spinlock.c')
-rw-r--r-- | spinlock.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -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(); } |