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

@ -28,6 +28,8 @@ int block_device_register(char *name, size_t lba_start, struct block_ops *ops, s
int res = devfs_insert_device_blk(ret->name, ret, &dirent);
(void)res;
krdy("Registered block device %s\n", name);
return 0;
}
@ -52,8 +54,6 @@ int block_check_partitions(struct block_device *bdev)
blkdev->part_of = bdev;
blkdev->size = descs[i].lba_end - descs[i].lba_start;
krdy("registered block device /dev/%s\n", blkdev->name);
}
if (descs)

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) {