summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--proc.c7
-rw-r--r--spinlock.c3
2 files changed, 8 insertions, 2 deletions
diff --git a/proc.c b/proc.c
index 751d886..9e95529 100644
--- a/proc.c
+++ b/proc.c
@@ -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)
{
diff --git a/spinlock.c b/spinlock.c
index a5f0b21..bf863ef 100644
--- a/spinlock.c
+++ b/spinlock.c
@@ -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