Skip to content

Commit

Permalink
comment about sched() saving/restoring cpu->intena
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Morris committed Sep 2, 2016
1 parent 4b2152c commit bc8221a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,12 @@ scheduler(void)
}

// Enter scheduler. Must hold only ptable.lock
// and have changed proc->state.
// and have changed proc->state. Saves and restores
// intena because intena is a property of this
// kernel thread, not this CPU. It should
// be proc->intena and proc->ncli, but that would
// break in the few places where a lock is held but
// there's no process.
void
sched(void)
{
Expand Down
3 changes: 2 additions & 1 deletion spinlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ pushcli(void)

eflags = readeflags();
cli();
if(cpu->ncli++ == 0)
if(cpu->ncli == 0)
cpu->intena = eflags & FL_IF;
cpu->ncli += 1;
}

void
Expand Down

0 comments on commit bc8221a

Please sign in to comment.