diff options
author | Zachary Yedidia <zyedidia@gmail.com> | 2022-05-13 15:17:50 -0700 |
---|---|---|
committer | Zachary Yedidia <zyedidia@gmail.com> | 2022-05-13 15:17:50 -0700 |
commit | 5adca42ff4e8a2a6352408158e062d6b22a677d7 (patch) | |
tree | cd34fc24e379d4c52cd8698aca8b567a7bd6acac | |
parent | 88c3d68d3b4c4cb209e9fc80bef84c47c9c8474a (diff) |
Fix dev barrier in reboot
-rw-r--r-- | .editorconfig | 2 | ||||
-rw-r--r-- | kern/boot.c | 3 | ||||
-rw-r--r-- | kern/kern.c | 2 |
3 files changed, 6 insertions, 1 deletions
diff --git a/.editorconfig b/.editorconfig index 6110e72..00ed235 100644 --- a/.editorconfig +++ b/.editorconfig @@ -3,7 +3,7 @@ charset = utf-8 end_of_line = lf insert_final_newline = true -[*.[ch]] +[*.[chs]] indent_style = space indent_size = 4 trim_trailing_whitespace = true diff --git a/kern/boot.c b/kern/boot.c index 83afcb6..605f4a1 100644 --- a/kern/boot.c +++ b/kern/boot.c @@ -20,6 +20,9 @@ extern void __attribute__((section(".text.boot"))) _hlt(); // map va to pa in the kernel pagetable static void vm_kernel_map(uintptr_t va, uintptr_t pa) { + // since we are running before the mmu is enabled, physical addresses are + // the actual addresses so we need to convert kernel_pagetable from a + // kernel address before using it pte_1mb_t *pgtbl = (pte_1mb_t *) ka2pa((uintptr_t) kernel_pagetable); unsigned pte_idx = va >> 20; diff --git a/kern/kern.c b/kern/kern.c index 533fe6a..9e36502 100644 --- a/kern/kern.c +++ b/kern/kern.c @@ -15,6 +15,8 @@ void reboot() { printf("DONE!!!\n"); uart_tx_flush(); + dsb(); + volatile uint32_t *PM_RSTC = (uint32_t *) pa2ka(0x2010001c); volatile uint32_t *PM_WDOG = (uint32_t *) pa2ka(0x20100024); |