diff options
| author | Ada Christine <adachristine18@gmail.com> | 2021-04-28 15:35:03 +0000 |
|---|---|---|
| committer | Ada Christine <adachristine18@gmail.com> | 2021-04-28 15:35:03 +0000 |
| commit | 4fffc7eb44a6d85fdc5627a71cff4f392068f5e7 (patch) | |
| tree | 97f938e816d6aec5a3befdf425dc42b997d67760 /kernel/memory.c | |
| parent | a2e3cd1932263b3b8084803beaa16669bf88f504 (diff) | |
changed loader allocation, preparing for boot data revamp
Diffstat (limited to 'kernel/memory.c')
| -rw-r--r-- | kernel/memory.c | 12 |
1 files changed, 6 insertions, 6 deletions
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); |
