Skip to content

Commit

Permalink
rename splhi/spllo to pushcli/popcli
Browse files Browse the repository at this point in the history
  • Loading branch information
rsc committed Sep 27, 2007
1 parent 39c3fb1 commit 3807c1f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ void getcallerpcs(void*, uint*);
int holding(struct spinlock*);
void initlock(struct spinlock*, char*);
void release(struct spinlock*);
void splhi();
void spllo();
void pushcli();
void popcli();

// string.c
int memcmp(const void*, const void*, uint);
Expand Down
6 changes: 3 additions & 3 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ main(void)
// clear BSS
memset(edata, 0, end - edata);

// splhi() every processor during bootstrap.
// pushcli() every processor during bootstrap.
for(i=0; i<NCPU; i++)
cpus[i].nsplhi = 1; // no interrupts during bootstrap
cpus[i].ncli = 1; // no interrupts during bootstrap

mp_init(); // collect info about this machine
bcpu = mp_bcpu();
Expand Down Expand Up @@ -63,7 +63,7 @@ mpmain(void)
asm volatile("movl %0, %%ss" :: "r" (SEG_CPUSTACK << 3));
cpuid(0, 0, 0, 0, 0); // memory barrier
cpus[cpu()].booted = 1;
spllo();
popcli();

scheduler();
}
Expand Down
10 changes: 5 additions & 5 deletions proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ setupsegs(struct proc *p)
{
struct cpu *c;

splhi();
pushcli();
c = &cpus[cpu()];
c->ts.ss0 = SEG_PROCSTACK << 3;
if(p)
Expand All @@ -97,7 +97,7 @@ setupsegs(struct proc *p)

lgdt(c->gdt, sizeof(c->gdt));
ltr(SEG_TSS << 3);
spllo();
popcli();
}

// Create a new process copying p as the parent.
Expand Down Expand Up @@ -189,9 +189,9 @@ curproc(void)
{
struct proc *p;

splhi();
pushcli();
p = cpus[cpu()].curproc;
spllo();
popcli();
return p;
}

Expand Down Expand Up @@ -249,7 +249,7 @@ sched(void)
panic("sched running");
if(!holding(&proc_table_lock))
panic("sched proc_table_lock");
if(cpus[cpu()].nsplhi != 1)
if(cpus[cpu()].ncli != 1)
panic("sched locks");

swtch(&cp->context, &cpus[cpu()].context);
Expand Down
2 changes: 1 addition & 1 deletion proc.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct cpu {
struct segdesc gdt[NSEGS]; // x86 global descriptor table
char *stack;
volatile int booted; // Has the CPU started?
int nsplhi; // Depth of splhi nesting.
int ncli; // Depth of pushcli nesting.
};

extern struct cpu cpus[NCPU];
Expand Down
18 changes: 9 additions & 9 deletions spinlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ initlock(struct spinlock *lock, char *name)
void
acquire(struct spinlock *lock)
{
splhi();
pushcli();
if(holding(lock))
panic("acquire");

Expand Down Expand Up @@ -59,7 +59,7 @@ release(struct spinlock *lock)
cpuid(0, 0, 0, 0, 0); // memory barrier (see Ch 7, IA-32 manual vol 3)

lock->locked = 0;
spllo();
popcli();
}

// Record the current call stack in pcs[] by following the %ebp chain.
Expand Down Expand Up @@ -93,20 +93,20 @@ holding(struct spinlock *lock)
// Better names? Better functions?

void
splhi(void)
pushcli(void)
{
cli();
cpus[cpu()].nsplhi++;
cpus[cpu()].ncli++;
}

void
spllo(void)
popcli(void)
{
if(read_eflags()&FL_IF)
panic("spllo - interruptible");
if(--cpus[cpu()].nsplhi < 0)
panic("spllo");
if(cpus[cpu()].nsplhi == 0)
panic("popcli - interruptible");
if(--cpus[cpu()].ncli < 0)
panic("popcli");
if(cpus[cpu()].ncli == 0)
sti();
}

4 changes: 2 additions & 2 deletions trap.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ trap(struct trapframe *tf)
}

// No interrupts during interrupt handling.
splhi();
pushcli();

switch(tf->trapno){
case IRQ_OFFSET + IRQ_TIMER:
Expand Down Expand Up @@ -84,7 +84,7 @@ trap(struct trapframe *tf)
cp->killed = 1;
}

spllo();
popcli();

// Force process exit if it has been killed and is in user space.
// (If it is still executing in the kernel, let it keep running
Expand Down

0 comments on commit 3807c1f

Please sign in to comment.