From 6da70f16c584ee897a4ac4f51d016a615c84042b Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Fri, 18 Sep 2026 15:46:18 -0400 Subject: cleanup for real hw attempt --- boot/limine/memorymap.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'boot/limine/memorymap.c') diff --git a/boot/limine/memorymap.c b/boot/limine/memorymap.c index 72c8de3..25dcc61 100644 --- a/boot/limine/memorymap.c +++ b/boot/limine/memorymap.c @@ -1,4 +1,5 @@ #include "hal/obj.h" +#include "jove.h" #include "limine.h" #include "hal/memory.h" #include "hal/obj.h" @@ -7,7 +8,10 @@ #include "lib/printf.h" extern struct limine_memmap_response *_limine_memmap_resp; + +PAGEALIGN static jove_objdir_t s_untyped_objdir; +static jove_objdir_t s_hwmemory_objdir; #define MEMMAP_MAX_ENTRIES 255 @@ -40,7 +44,7 @@ mem_setup_untyped(void) kprintf("Memory map provided by Limine:\n"); size_t untyped_i = 0; - size_t acpi_i = 0; + size_t hwmem_i = 0; uintptr_t highest_phys = 0; for(size_t i = 0; i < _limine_memmap_resp->entry_count; i++) { @@ -70,6 +74,21 @@ mem_setup_untyped(void) break; } } + if(entry->type == LIMINE_MEMMAP_RESERVED | + entry->type == LIMINE_MEMMAP_ACPI_NVS | + entry->type == LIMINE_MEMMAP_ACPI_TABLES) + { + size_t hw_pages = entry->length >> 12; + if(hw_pages > 4095) { + klogf("HW memory page is too big!\n", ""); + } + + jove_owned_obj_t *hwmem_obj = obj_take(&s_hwmemory_objdir.entries[hwmem_i++]); + obj_settype(hwmem_obj, JOVE_OBJ_HWMEMORY); + obj_setvalue(hwmem_obj, entry->base | (entry->length >> 12)); + + obj_release(hwmem_obj); + } } kprintf("Highest physical address: %p\n", highest_phys); } -- cgit v1.2.3