boot: fix crash on early memory allocations

Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
Michael Shaw 2026-08-11 18:29:51 -04:00
commit 1d1dad34ce
10 changed files with 120 additions and 32 deletions

View file

@ -6,6 +6,7 @@
#include <lib/string.h>
#define USTACK_DEFAULT_SIZE 0x10000
#define P_STACK_SIZE 0x4000
mem_cache_t *proc_slab;
mem_cache_t *thread_slab;
@ -100,6 +101,14 @@ struct proc *proc_create(struct thread *parent)
r_mt->proc = ret;
r_mt->state = PROC_STATE_DNS;
void *kstack = kalloc(P_STACK_SIZE, ALLOC_KERN);
if (!kstack) {
slab_free(proc_slab, ret);
slab_free(thread_slab, r_mt);
return NULL;
}
r_mt->kstack_top = (uaddr_t)kstack + P_STACK_SIZE;
void *ustack = proc_alloc(ret, r_mt->stack_size);
if (!ustack) {