check preconditions in sched

This commit is contained in:
rsc 2006-09-07 16:54:00 +00:00
parent e7a5b3c5ee
commit b6cac0a53b

5
proc.c
View file

@ -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);
}