diff options
author | Robert Morris <[email protected]> | 2019-06-05 14:14:57 -0400 |
---|---|---|
committer | Robert Morris <[email protected]> | 2019-06-05 14:14:57 -0400 |
commit | 5eb1cb49722cce9afee48886a8db138d5f58d0ff (patch) | |
tree | ee8c81e5b3fdfc75e154e23687f53fcb50158617 /proc.c | |
parent | 31136437684b5987ef46f4c6947940cf96de75b3 (diff) | |
download | xv6-labs-5eb1cb49722cce9afee48886a8db138d5f58d0ff.tar.gz xv6-labs-5eb1cb49722cce9afee48886a8db138d5f58d0ff.tar.bz2 xv6-labs-5eb1cb49722cce9afee48886a8db138d5f58d0ff.zip |
push_off() and pop_off() in myproc()
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -11,7 +11,6 @@ struct { struct proc proc[NPROC]; } ptable; -// XXX riscv move somewhere else struct cpu cpus[NCPU]; struct proc *initproc; @@ -54,10 +53,10 @@ mycpu(void) { // Return the current struct proc *. struct proc* myproc(void) { - // XXX push intr off + push_off(); struct cpu *c = mycpu(); struct proc *p = c->proc; - // XXX pop intr + pop_off(); return p; } @@ -403,8 +402,13 @@ sched(void) if(!holding(&ptable.lock)) panic("sched ptable.lock"); + if(mycpu()->noff != 1) + panic("sched locks"); if(p->state == RUNNING) panic("sched running"); + if(intr_get()) + panic("sched interruptible"); + intena = mycpu()->intena; swtch(&p->context, &mycpu()->scheduler); mycpu()->intena = intena; |