diff options
author | Danny Holman <dholman@gymli.org> | 2024-06-25 13:00:47 -0500 |
---|---|---|
committer | Danny Holman <dholman@gymli.org> | 2024-06-25 13:00:47 -0500 |
commit | 2abe7e3e878b9b4ed3660b8f10eaf3caef2e0ea1 (patch) | |
tree | f5a19193962c4976c76b1bc87a37eeb8fcaca8f5 | |
parent | 0dc4d97e70c17df56a260d31a1cb44881cf64520 (diff) |
arch: i386: paging: reserve the last page table
Reserve the last, usable page table for temporary mappings, such as
those required by the physical memory manager.
Signed-off-by: Danny Holman <dholman@gymli.org>
-rw-r--r-- | arch/i386/kernel/paging.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/i386/kernel/paging.c b/arch/i386/kernel/paging.c index b8e00af..a0bbb92 100644 --- a/arch/i386/kernel/paging.c +++ b/arch/i386/kernel/paging.c @@ -20,10 +20,13 @@ void paging_init(void) { pt[GET_PTX(GET_VADDR(i))] = i | PD_PRES; unmap_page(PAGE_TMP_MAP); + uintptr_t temp_pt = pfa_alloc(1); + uintptr_t phys_pd = pfa_alloc(1); map_page(phys_pd, PAGE_TMP_MAP, PD_PRES | PD_RW); uintptr_t *pd = (uintptr_t*)PAGE_TMP_MAP; pd[GET_PDX(GET_VADDR(KSTART))] = phys_pt | PD_PRES | PD_RW; + pd[GET_PDX(PAGE_TMP_MAP)] = temp_pt | PD_PRES | PD_RW; pd[1023] = phys_pd | PD_PRES | PD_RW; unmap_page(PAGE_TMP_MAP); |