summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorRobert Morris <[email protected]>2022-10-16 15:28:21 -0400
committerRobert Morris <[email protected]>2022-10-16 15:28:21 -0400
commitf376ad7f1f80bddfb754b21811d17959c45d43a4 (patch)
tree6ebc997cd7105509d0c1b2b7d1865cbe796b24d1 /kernel
parent348cf7fee4023fce9b023145d89429ee8fdde00d (diff)
downloadxv6-labs-f376ad7f1f80bddfb754b21811d17959c45d43a4.tar.gz
xv6-labs-f376ad7f1f80bddfb754b21811d17959c45d43a4.tar.bz2
xv6-labs-f376ad7f1f80bddfb754b21811d17959c45d43a4.zip
scheduler()'s intr_on() is in the wrong place, reflecting
the locking scheme from long ago.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/proc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/kernel/proc.c b/kernel/proc.c
index 659ca54..bc4b274 100644
--- a/kernel/proc.c
+++ b/kernel/proc.c
@@ -446,12 +446,13 @@ scheduler(void)
{
struct proc *p;
struct cpu *c = mycpu();
+
+ // Interrupts are disabled at first, but they must be
+ // enabled in order for the shell to get input.
+ intr_on();
c->proc = 0;
for(;;){
- // Avoid deadlock by ensuring that devices can interrupt.
- intr_on();
-
for(p = proc; p < &proc[NPROC]; p++) {
acquire(&p->lock);
if(p->state == RUNNABLE) {