check preconditions in sched
This commit is contained in:
parent
e7a5b3c5ee
commit
b6cac0a53b
1 changed files with 5 additions and 0 deletions
5
proc.c
5
proc.c
|
@ -207,6 +207,11 @@ sched(void)
|
|||
{
|
||||
struct proc *p = curproc[cpu()];
|
||||
|
||||
if(!holding(&proc_table_lock))
|
||||
panic("sched");
|
||||
if(cpus[cpu()].nlock != 1)
|
||||
panic("sched locks");
|
||||
|
||||
if(setjmp(&p->jmpbuf) == 0)
|
||||
longjmp(&cpus[cpu()].jmpbuf);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue