Remove sched_ticks, move proc_reaper() out to proc_tick() function
This commit is contained in:
@ -21,10 +21,7 @@
|
||||
#include "errors.h"
|
||||
#include "kprintf.h"
|
||||
|
||||
#define PROC_REAPER_FREQ 30
|
||||
|
||||
uint64_t pids = 0;
|
||||
uint64_t sched_ticks = 0;
|
||||
|
||||
Procs PROCS;
|
||||
|
||||
@ -223,17 +220,18 @@ void proc_reaper(void) {
|
||||
spinlock_release(&PROCS.spinlock);
|
||||
}
|
||||
|
||||
void proc_tick(void) {
|
||||
proc_reaper();
|
||||
}
|
||||
|
||||
void proc_sched(void *cpustate) {
|
||||
intr_disable();
|
||||
sched_ticks++;
|
||||
|
||||
memcpy(&PROCS.current->platformdata.trapframe, cpustate, sizeof(IntrStackFrame));
|
||||
|
||||
PROCS.current = proc_nextready();
|
||||
|
||||
if (sched_ticks % PROC_REAPER_FREQ == 0) {
|
||||
proc_reaper();
|
||||
}
|
||||
|
||||
proc_tick();
|
||||
|
||||
tss.rsp0 = (uint64_t)VIRT(PROCS.current->platformdata.kstack);
|
||||
proc_switch(&PROCS.current->platformdata.trapframe, (void *)PROCS.current->platformdata.cr3);
|
||||
|
||||
Reference in New Issue
Block a user