all procs are user procs

This commit is contained in:
2025-09-29 21:32:07 +02:00
parent 20a89502c0
commit 4e8afae5fb
5 changed files with 13 additions and 36 deletions

View File

@ -200,21 +200,19 @@ void proc_reaper(void) {
pmm_free((uintptr_t)(zombie->platformdata.kstack - PROC_STACKSIZE), PROC_STACKBLOCKS);
pmm_free((uintptr_t)(zombie->platformdata.pstack - PROC_STACKSIZE), PROC_STACKBLOCKS);
if (!zombie->kern) {
VasRange *vas, *vastmp;
LL_FOREACH_SAFE(zombie->vas, vas, vastmp) {
hal_vmm_unmap_range(zombie->platformdata.cr3, vas->virtstart, vas->physstart, vas->size);
pmm_free((uintptr_t)vas->physstart, vas->size / HAL_PAGE_SIZE);
dlfree(vas);
}
VasRange *vas, *vastmp;
LL_FOREACH_SAFE(zombie->vas, vas, vastmp) {
hal_vmm_unmap_range(zombie->platformdata.cr3, vas->virtstart, vas->physstart, vas->size);
pmm_free((uintptr_t)vas->physstart, vas->size / HAL_PAGE_SIZE);
dlfree(vas);
}
pmm_free((uintptr_t)zombie->platformdata.cr3, 1);
pmm_free((uintptr_t)zombie->platformdata.cr3, 1);
ProcArg *arg, *argtmp;
LL_FOREACH_SAFE(zombie->procargs.list, arg, argtmp) {
dlfree(arg->string);
dlfree(arg);
}
ProcArg *arg, *argtmp;
LL_FOREACH_SAFE(zombie->procargs.list, arg, argtmp) {
dlfree(arg->string);
dlfree(arg);
}
dlfree(zombie);
}
@ -250,22 +248,6 @@ void proc_killself(void) {
spinlock_release(&PROCS.spinlock);
}
void proc_status(void) {
static const char *statuses[] = {"ready", "running", "zombie", "waiting"};
for (;;) {
spinlock_acquire(&PROCS.spinlock);
Proc *head = PROCS.procs;
while (head) {
kprintf("%s %s %s\n", head->kern ? "kern" : "user", statuses[head->state], head->name);
head = head->next;
}
kprintf("\n\n");
spinlock_release(&PROCS.spinlock);
hal_wait(3 * 1000);
}
}
void proc_init(void) {
spinlock_init(&PROCS.spinlock);
PROCS.procs = NULL;