diff options
Diffstat (limited to 'boot/limine/memorymap.c')
| -rw-r--r-- | boot/limine/memorymap.c | 21 |
1 files changed, 20 insertions, 1 deletions
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); } |
