From 122374c362ba8bb9082385da3c82e264ab594f15 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sun, 7 Jul 2024 07:00:43 +0300 Subject: smp now seems to work + Had some minor issues with a wraparound of size_t that effectively meant that some regions were allocated twice. Also, booting should be a bit more reliable now, turned out that the previous iteration of the booting was just accidentally working due to the kernel being placed 'close enough' in RAM to where it was linked to. Fixed by allocating a vmem of O1 that maps the kernel to a 2MiB boundary at boot, pretty nifty. --- src/regions.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/regions.c') diff --git a/src/regions.c b/src/regions.c index 66ee546..f098f4f 100644 --- a/src/regions.c +++ b/src/regions.c @@ -316,7 +316,10 @@ struct mem_region *find_free_region(struct mem_region_root *r, size_t size, vm_t start = align_up(t->start, offset); size_t qsize = t->end - t->start; - size_t bsize = t->end - start; + + size_t bsize = 0; + if (t->end >= start) + bsize = t->end - start; if (!quick_best && size <= qsize) quick_best = t; -- cgit v1.3