Paging now functionnal

This commit is contained in:
Adrien Bourmault 2020-01-17 23:13:52 +01:00
parent f7e857a946
commit 018bdc4ff6
3 changed files with 5 additions and 14 deletions

View File

@ -81,10 +81,6 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg)
KeGetCpuInfos(); KeGetCpuInfos();
IoEnableKeyb(); IoEnableKeyb();
for (ulong curAddrPT = 0x00971db000; curAddrPT <= 0x00971fc000; curAddrPT+= (ulong)KPAGESIZE) {
DebugLog("\t\t\t\tTable %p : %p\n", MmTransPhyToVirtAddr((void*)curAddrPT), MmTransVirtToPhyAddr((void*)curAddrPT));
}
// Command line (kernel mode) // Command line (kernel mode)
ShStartShell(); ShStartShell();

View File

@ -58,9 +58,9 @@ void MmInitGdt(void)
tssDesc.veryHighBase = ((ulong)&tss >> 32) & 0xFFFFFFFF; tssDesc.veryHighBase = ((ulong)&tss >> 32) & 0xFFFFFFFF;
tssDesc.lowLimit = sizeof(tss); tssDesc.lowLimit = sizeof(tss);
tss.ist1 = (ulong)0x0007FFFF; // ISR RESCUE STACK, GARANTIED FREE FOR USE BY OSDEV.ORG tss.ist1 = (ulong)0x00007BFF; // ISR RESCUE STACK, GARANTIED FREE FOR USE BY OSDEV.ORG
tss.ist2 = (ulong)0x00EFFFFF; // ISR STACK, GARANTIED FREE FOR USE BY OSDEV.ORG tss.ist2 = (ulong)0x00043F00; // ISR STACK, GARANTIED FREE FOR USE BY OSDEV.ORG
tss.ist3 = (ulong)0x00EF0000; // ISR STACK, GARANTIED FREE FOR USE BY OSDEV.ORG tss.ist3 = (ulong)0x0007FFFF; // ISR STACK, GARANTIED FREE FOR USE BY OSDEV.ORG
tss.iomap_base = sizeof(tss); tss.iomap_base = sizeof(tss);
memmove(&gdt[2], &tssDesc, sizeof(TssDescriptor_t)); memmove(&gdt[2], &tssDesc, sizeof(TssDescriptor_t));

View File

@ -170,13 +170,13 @@ void MmInitPaging(void)
MmPT[index] = (ulong)curAddrPT | PRESENT; MmPT[index] = (ulong)curAddrPT | PRESENT;
MmPhysicalPageTable[xedni] = (ulong)curAddrPT; MmPhysicalPageTable[xedni] = (ulong)curAddrPT;
MmStackGuards[0] = (ulong)curAddrPT; MmStackGuards[0] = (ulong)curAddrPT;
DebugLog("\tStack Guard at %p\n", curAddrPT); //DebugLog("\tStack Guard at %p\n", curAddrPT);
} }
else if ((ulong)curAddrPT == (ulong)BtLoaderInfo.kernelEndAddr) { else if ((ulong)curAddrPT == (ulong)BtLoaderInfo.kernelEndAddr) {
MmPT[index] = (ulong)curAddrPT | PRESENT; MmPT[index] = (ulong)curAddrPT | PRESENT;
MmPhysicalPageTable[xedni] = (ulong)curAddrPT; MmPhysicalPageTable[xedni] = (ulong)curAddrPT;
MmStackGuards[1] = (ulong)curAddrPT; MmStackGuards[1] = (ulong)curAddrPT;
DebugLog("\tStack Guard at %p\n", curAddrPT); //DebugLog("\tStack Guard at %p\n", curAddrPT);
} }
// SECTION .TEXT PROTECTION // SECTION .TEXT PROTECTION
else if ((ulong)curAddrPT >= (ulong)&_text && (ulong)curAddrPT <= (ulong)&_text_end) { else if ((ulong)curAddrPT >= (ulong)&_text && (ulong)curAddrPT <= (ulong)&_text_end) {
@ -211,11 +211,6 @@ void MmInitPaging(void)
MmEnableWriteProtect(); MmEnableWriteProtect();
DebugLog("\tPage table size : %u MB\n", (lastDirectoryAddr - firstDirectoryAddr + phDirSize)/MB); DebugLog("\tPage table size : %u MB\n", (lastDirectoryAddr - firstDirectoryAddr + phDirSize)/MB);
for (ulong curAddrPT = 0x00971db000; curAddrPT <= 0x00971fc000; curAddrPT+= (ulong)KPAGESIZE) {
DebugLog("\t\t\t\tTable %p : %p\n", MmTransPhyToVirtAddr((void*)curAddrPT), MmTransVirtToPhyAddr((void*)curAddrPT));
}
DebugLog("\n");
} }
// //