Mercurial > hg > Members > anatofuz > CbC_xv6
changeset 28:68de775c3a29
add cbc_sched
author | mir3636 |
---|---|
date | Fri, 18 Jan 2019 09:40:22 +0900 |
parents | 1a64b5645cdd |
children | a672d603ccb2 |
files | src/proc.c |
diffstat | 1 files changed, 28 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/proc.c Thu Jan 17 19:55:30 2019 +0900 +++ b/src/proc.c Fri Jan 18 09:40:22 2019 +0900 @@ -353,6 +353,34 @@ } } +__code cbc_sched(__code(*next)()) +{ + int intena; + + if(!holding(&ptable.lock)) { + panic("sched ptable.lock"); + } + + if(cpu->ncli != 1) { + panic("sched locks"); + } + + if(proc->state == RUNNING) { + panic("sched running"); + } + + if(int_enabled ()) { + panic("sched interruptible"); + } + + intena = cpu->intena; + swtch(&proc->context, cpu->scheduler); + cpu->intena = intena; + + goto next(); +} + + // Enter scheduler. Must hold only ptable.lock // and have changed proc->state. void sched(void)