summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorAda Christine <adachristine18@gmail.com>2021-04-28 15:35:03 +0000
committerAda Christine <adachristine18@gmail.com>2021-04-28 15:35:03 +0000
commit4fffc7eb44a6d85fdc5627a71cff4f392068f5e7 (patch)
tree97f938e816d6aec5a3befdf425dc42b997d67760 /kernel
parenta2e3cd1932263b3b8084803beaa16669bf88f504 (diff)
changed loader allocation, preparing for boot data revamp
Diffstat (limited to 'kernel')
-rw-r--r--kernel/entry_efi.c15
-rw-r--r--kernel/memory.c12
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);