Handle process arguments

This commit is contained in:
2025-09-10 23:25:03 +02:00
parent 2f9f4d9397
commit dc3d80d707
13 changed files with 127 additions and 23 deletions

View File

@ -198,7 +198,6 @@ Proc *proc_nextready(void) {
}
proc = proc->next;
}
return proc;
}
void proc_reaper(void) {
@ -243,6 +242,14 @@ void proc_reaper(void) {
}
pmm_free((uintptr_t)zombie->platformdata.cr3, 1);
ProcArg *arg = zombie->procargs.list;
while (arg) {
dlfree(arg->string);
ProcArg *tmp = arg;
arg = arg->next;
dlfree(tmp);
}
}
dlfree(zombie);
} else {
@ -251,19 +258,21 @@ void proc_reaper(void) {
}
}
extern void hal_zombiespin(void);
void proc_sched(void *cpustate) {
hal_intr_disable();
sched_ticks++;
if (sched_ticks % PROC_REAPER_FREQ == 0) {
proc_reaper();
}
IntrStackFrame *frame = cpustate;
PROCS.current->platformdata.trapframe = *frame;
PROCS.current = proc_nextready();
if (sched_ticks % PROC_REAPER_FREQ == 0) {
proc_reaper();
}
hal_switchproc(&PROCS.current->platformdata.trapframe, (void *)PROCS.current->platformdata.cr3);
}