* E480 00000000 - E500 00000000 39 512 GiB Physical Page DblAlloc Bitmap (1 page per bit)
* E500 00000000 - E500 80000000 31 2 GiB Physical Page Super Bitmap (64 pages per bit)
* FD00 00000000 - FD80 00000000 39 512 GiB Local APIC
- * FE00 00000000 - FE80 00000000 39 512 GiB Fractal Mapping (PML4 510)
+ * FE00 00000000 - FE80 00000000 39 512 GiB Fractal Mapping (PML4 508)
* FE80 00000000 - FF00 00000000 39 512 GiB Temp Fractal Mapping
* FF00 00000000 - FF80 00000000 39 512 GiB -- UNUSED --
* FF80 00000000 - FFFF 80000000 ~39 GiB -- UNUSED --
#define USER_STACK_SZ 0x00000000##00020000 // 64 KiB
#define USER_STACK_TOP 0x00007FFF##FFFFF000
#define MM_USER_MAX 0x00007FFF##FFFFF000
-//#define KERNEL_BASE 0xFFFF8000##00000000
-#define MM_KHEAP_BASE (KERNEL_BASE|(0x8000##80000000))
-#define MM_KHEAP_MAX (KERNEL_BASE|(0x9000##00000000))
-#define MM_MODULE_MIN (KERNEL_BASE|(0x9000##00000000))
-#define MM_MODULE_MAX (KERNEL_BASE|(0x9800##00000000))
-#define MM_KERNEL_VFS (KERNEL_BASE|(0x9800##00000000))
-#define MM_KSTACK_BASE (KERNEL_BASE|(0xA000##00000000))
-#define MM_KSTACK_TOP (KERNEL_BASE|(0xB000##00000000))
+#define MM_KERNEL_RANGE 0xFFFF8000##00000000
+#define MM_KHEAP_BASE (MM_KERNEL_RANGE|(0x8000##80000000))
+#define MM_KHEAP_MAX (MM_KERNEL_RANGE|(0x9000##00000000))
+#define MM_MODULE_MIN (MM_KERNEL_RANGE|(0x9000##00000000))
+#define MM_MODULE_MAX (MM_KERNEL_RANGE|(0x9800##00000000))
+#define MM_KERNEL_VFS (MM_KERNEL_RANGE|(0x9800##00000000))
+#define MM_KSTACK_BASE (MM_KERNEL_RANGE|(0xA000##00000000))
+#define MM_KSTACK_TOP (MM_KERNEL_RANGE|(0xB000##00000000))
-#define MM_HWMAP_BASE (KERNEL_BASE|(0xC000##00000000))
-#define MM_HWMAP_TOP (KERNEL_BASE|(0xD000##00000000))
-#define MM_PPD_BASE (KERNEL_BASE|(0xD000##00000000))
+#define MM_HWMAP_BASE (MM_KERNEL_RANGE|(0xC000##00000000))
+#define MM_HWMAP_TOP (MM_KERNEL_RANGE|(0xD000##00000000))
+#define MM_PPD_BASE (MM_KERNEL_RANGE|(0xD000##00000000))
#define MM_PPD_CFG MM_PPD_BASE
-#define MM_PPD_VFS (KERNEL_BASE|(0xD008##00000000))
-#define MM_USER_CODE (KERNEL_BASE|(0xD080##00000000))
+#define MM_PPD_VFS (MM_KERNEL_RANGE|(0xD008##00000000))
+#define MM_USER_CODE (MM_KERNEL_RANGE|(0xD080##00000000))
-#define MM_PAGE_COUNTS (KERNEL_BASE|(0xE000##00000000))
-#define MM_PAGE_BITMAP (KERNEL_BASE|(0xE400##00000000))
-#define MM_PAGE_DBLBMP (KERNEL_BASE|(0xE480##00000000))
-#define MM_PAGE_SUPBMP (KERNEL_BASE|(0xE500##00000000))
+#define MM_PAGE_COUNTS (MM_KERNEL_RANGE|(0xE000##00000000))
+#define MM_PAGE_BITMAP (MM_KERNEL_RANGE|(0xE400##00000000))
+#define MM_PAGE_DBLBMP (MM_KERNEL_RANGE|(0xE480##00000000))
+#define MM_PAGE_SUPBMP (MM_KERNEL_RANGE|(0xE500##00000000))
-#define MM_LOCALAPIC (KERNEL_BASE|(0xFD00##00000000))
-#define MM_FRACTAL_BASE (KERNEL_BASE|(0xFE00##00000000))
-#define MM_TMPFRAC_BASE (KERNEL_BASE|(0xFE80##00000000))
+#define MM_LOCALAPIC (MM_KERNEL_RANGE|(0xFD00##00000000))
+#define MM_FRACTAL_BASE (MM_KERNEL_RANGE|(0xFE00##00000000))
+#define MM_TMPFRAC_BASE (MM_KERNEL_RANGE|(0xFE80##00000000))
// === FUNCTIONS ===
// === CODE ===
void MM_InitVirt(void)
{
+ MM_DumpTables(0, -1L);
}
void MM_FinishVirtualInit(void)
tVAddr curPos;
Uint page;
+ Log("Table Entries: (%p to %p)", Start, End);
+
End &= (1L << 48) - 1;
Start >>= 12; End >>= 12;
- Log("Table Entries:");
for(page = Start, curPos = Start<<12;
page < End;
curPos += 0x1000, page++)
if( curPos == 0x800000000000L )
curPos = 0xFFFF800000000000L;
+ //Debug("&PAGEMAPLVL4(%i page>>27) = %p", page>>27, &PAGEMAPLVL4(page>>27));
+ //Debug("&PAGEDIRPTR(%i page>>18) = %p", page>>18, &PAGEDIRPTR(page>>18));
+ //Debug("&PAGEDIR(%i page>>9) = %p", page>>9, &PAGEDIR(page>>9));
+ //Debug("&PAGETABLE(%i page) = %p", page, &PAGETABLE(page));
+
// End of a range
if(
!(PAGEMAPLVL4(page>>27) & PF_PRESENT)
if( !(PAGEMAPLVL4(page>>27) & PF_PRESENT) ) {
page += (1 << 27) - 1;
curPos += (1L << 39) - 0x1000;
+ //Debug("pml4 ent unset (page = 0x%x now)", page);
continue;
}
if( !(PAGEDIRPTR(page>>18) & PF_PRESENT) ) {
page += (1 << 18) - 1;
curPos += (1L << 30) - 0x1000;
+ //Debug("pdp ent unset (page = 0x%x now)", page);
continue;
}
if( !(PAGEDIR(page>>9) & PF_PRESENT) ) {
page += (1 << 9) - 1;
curPos += (1L << 21) - 0x1000;
+ //Debug("pd ent unset (page = 0x%x now)", page);
continue;
}
if( !(PAGETABLE(page) & PF_PRESENT) ) continue;