diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/entry_efi.c | 15 | ||||
| -rw-r--r-- | kernel/memory.c | 12 |
2 files changed, 14 insertions, 13 deletions
diff --git a/kernel/entry_efi.c b/kernel/entry_efi.c index f4eeb9c..5eecaf2 100644 --- a/kernel/entry_efi.c +++ b/kernel/entry_efi.c @@ -1,4 +1,11 @@ -#include <loader/data.h> +#include "cpu.h" +#include "serial.h" +#include "kprint.h" +#include "memory.h" +#include "panic.h" + +#include <loader/data_efi.h> + #include <kernel/entry.h> #include <stdbool.h> @@ -6,12 +13,6 @@ #include <stdint.h> #include <stdnoreturn.h> -#include "cpu.h" -#include "serial.h" -#include "kprint.h" -#include "memory.h" -#include "panic.h" - static void efi_memory_init(struct efi_memory_map_data *map) { // FIXME: bad girl shit: overwriting on aliased pointers. diff --git a/kernel/memory.c b/kernel/memory.c index 08028c6..31dd6f1 100644 --- a/kernel/memory.c +++ b/kernel/memory.c @@ -468,20 +468,20 @@ int anonymous_page_handler(uint32_t code, void *address) { // create a page table and install it phys_addr_t pm1_phys = page_alloc(); - uint64_t *pm1; if (pm1_phys) { + uint64_t *pm1; pm1 = page_map_at(temp, pm1_phys, CONTENT_RWDATA|SIZE_2M); + // zero the page + memset(pm1, 0, PAGE_SIZE); + // put the table where it goes + *pm2e = page_address(pm1_phys, 1)|PAGE_WR|PAGE_PR; + page_unmap(pm1); } else { panic(OUT_OF_MEMORY); } - // zero the page - memset(pm1, 0, PAGE_SIZE); - // put the table where it goes - *pm2e = page_address(pm1_phys, 1)|PAGE_WR|PAGE_PR; - page_unmap(pm1); } uint64_t *pm1e = get_kernel_pm1e(address); |
