From: Matthias Kruk Date: Fri, 20 Sep 2019 06:15:59 +0000 (+0900) Subject: Add code for debugging of PAE paging structures X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=3a34f6a29637ee0faf928c124d116337edd05c9e;p=corax Add code for debugging of PAE paging structures --- diff --git a/kernel/arch/paging.c b/kernel/arch/paging.c index 8a9e042..ee1587b 100644 --- a/kernel/arch/paging.c +++ b/kernel/arch/paging.c @@ -179,10 +179,53 @@ static void _pg_dir_debug_arch(pg_dir_t *pd) break; } - case PG_MODE_PAE: + case PG_MODE_PAE: { + struct pdpt *dir; + u32_t i; + + dir = (struct pdpt*)pd->pd_base; + + for(i = 0; i < 4; i++) { + struct pae_page_table *tbl; + int j; + + if(!(dir->pdpt_entries[i] & PAGE_ATTR_PRESENT)) { + continue; + } + + dbg_printf("cr3[%01u] = 0x%016llx\n", i, dir->pdpt_entries[i]); + tbl = (struct pae_page_table*)((unsigned long)dir->pdpt_entries[i] & ~0xfff); + + for(j = 0; j < 512; j++) { + struct pae_page_table *ttbl; + int k; + + if(!(tbl->ppt_entries[j] & PAGE_ATTR_PRESENT)) { + continue; + } + + dbg_printf("cr3[%01u][%03u] = 0x%016llx\n", i, j, tbl->ppt_entries[j]); + + if(!(tbl->ppt_entries[j] & PAGE_ATTR_SIZE)) { + ttbl = (struct pae_page_table*)((unsigned long)tbl->ppt_entries[j] & ~0xfff); + + for(k = 0; k < 512; k++) { + if(!(ttbl->ppt_entries[k] & PAGE_ATTR_PRESENT)) { + continue; + } + + dbg_printf("cr3[%01u][%03u][%03u] = 0x%016llx\n", + i, j, k, ttbl->ppt_entries[k]); + } + } + } + } + break; } + } + return; } #endif /* FEATURE(DEBUG) */