diff --git a/kaleid/kernel/ke/idt.c b/kaleid/kernel/ke/idt.c index a5d2e03..54ea408 100644 --- a/kaleid/kernel/ke/idt.c +++ b/kaleid/kernel/ke/idt.c @@ -175,7 +175,7 @@ void KeSetupIDT(void) // Load IDT KeLoadIDT(); - DebugLog("\tInterrupt table initialized\n"); + DebugLog("\tInterrupt table initialized at %p\n", _KeIdtPtr.base); } // diff --git a/kaleid/kernel/mm/paging.c b/kaleid/kernel/mm/paging.c index 6d82fe0..a22c6d6 100644 --- a/kaleid/kernel/mm/paging.c +++ b/kaleid/kernel/mm/paging.c @@ -3,7 +3,8 @@ #include #include -#define PAGESIZE (4 * KB) +#define KPAGESIZE (4 * KB) +#define UPAGESIZE (2 * MB) // Page directory pointer offset @@ -39,13 +40,13 @@ enum //----------- -volatile pdpe_t MmPML4[512] __attribute__((__aligned__(4096))); +volatile pdpe_t MmPML4[512] __attribute__((__aligned__(KPAGESIZE))); -volatile pde_t MmPDP[512] __attribute__((__aligned__(4096))); +volatile pde_t MmPDP[512] __attribute__((__aligned__(KPAGESIZE))); -volatile pde_t MmPD[512 * RAM_MAX] __attribute__((__aligned__(4096)));; +volatile pde_t MmPD[512 * RAM_MAX] __attribute__((__aligned__(KPAGESIZE)));; -volatile pte_t MmPT[512 * NB_4K] __attribute__((__aligned__(4096)));; +volatile pte_t MmPT[512 * NB_4K] __attribute__((__aligned__(KPAGESIZE)));; volatile ulong MmStackGuards[2] = { 0 }; @@ -63,25 +64,25 @@ void MmInitPaging(void) for (volatile ulong i = 0; i < 512 * NB_4K; i++) { // STACK GUARD PAGE - if ((ulong)(i*4096) == (ulong)BtLoaderInfo.stackEndAddr) { - MmPT[i] = ((ulong)(i*4096)); + if ((ulong)(i*KPAGESIZE) == (ulong)BtLoaderInfo.stackEndAddr) { + MmPT[i] = ((ulong)(i*KPAGESIZE)); MmStackGuards[0] = i; continue; } // ENOMEM like - if ((ulong)(i*4096) > (ulong)phRamSize) { + if ((ulong)(i*KPAGESIZE) > (ulong)phRamSize) { break; } // STACK GARD PAGE - if ((ulong)(i*4096) == (ulong)BtLoaderInfo.kernelEndAddr) { - MmPT[i] = ((ulong)(i*4096)); + if ((ulong)(i*KPAGESIZE) == (ulong)BtLoaderInfo.kernelEndAddr) { + MmPT[i] = ((ulong)(i*KPAGESIZE)); MmStackGuards[1] = i; continue; } - MmPT[i] = ((ulong)(i*4096)) | MF_PRESENT | MF_READWRITE; + MmPT[i] = ((ulong)(i*KPAGESIZE)) | MF_PRESENT | MF_READWRITE; } for (volatile ulong i = 0; i < NB_4K; i++) { @@ -90,12 +91,12 @@ void MmInitPaging(void) for (volatile ulong i = NB_4K; i < 512 * RAM_MAX; i++) { // ENOMEM like - if ((ulong)(i* 2048 * 1024) > (ulong)phRamSize) { + if ((ulong)(i* UPAGESIZE) > (ulong)phRamSize) { break; } MmPD[i] = 0; - MmPD[i] = ((ulong)(i* 2048 * 1024)) | MF_PRESENT | MF_READWRITE | MF_HUGE; + MmPD[i] = ((ulong)(i* UPAGESIZE)) | MF_PRESENT | MF_READWRITE | MF_HUGE; } for (volatile int i = 0; i < RAM_MAX; i++) { @@ -105,4 +106,5 @@ void MmInitPaging(void) MmPML4[0] = (ulong)(&MmPDP[0])| MF_PRESENT | MF_READWRITE; MmLoadPML4((void *)MmPML4); + DebugLog("\tPaging table initialized at %p, %p, %p, %p\n", &MmPML4, &MmPDP, &MmPD, &MmPT); }