From abf847a083888bbed4260ecacf849ea19f23e810 Mon Sep 17 00:00:00 2001 From: Frans Kaashoek Date: Tue, 31 Jan 2017 17:47:16 -0500 Subject: Start of an experiment to remove the use of gs for cpu local variables. --- spinlock.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'spinlock.c') 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(); } -- cgit v1.2.3