Paging works.

HOLY SHIT PAGING WORKS. THIS HAS BEEN SO MUCH WORK.

ALL IT TOOK WAS A BIT MASKgit add *.c !
This commit is contained in:
Curle 2021-03-16 00:13:37 +00:00
parent 51ce7fe132
commit d3c36a29af
Signed by: TheCurle
GPG Key ID: 5942F13718443F79
2 changed files with 4 additions and 4 deletions

View File

@ -60,7 +60,7 @@ void InitPaging() {
.PML4 = (size_t*) ReadControlRegister(3)
};
size_t AddressToFind = 0xffffffffffe021ba;
size_t AddressToFind = 0xffffffffffffff58;
size_t BootloaderAddress = DecodeVirtualAddressNoDirect(&BootloaderAddressSpace, AddressToFind);
size_t KernelDisoveredAddress = DecodeVirtualAddressNoDirect(&KernelAddressSpace, AddressToFind);
SerialPrintf("[ Mem] Diagnostic: Existing pagetables put 0x%p at 0x%p.\r\n", AddressToFind, BootloaderAddress);
@ -70,8 +70,8 @@ void InitPaging() {
//if(BootloaderAddress != KernelDisoveredAddress)
//for(;;) {}
SerialPrintf("[ Mem] Attempting to jump into our new pagetables.\r\n");
WriteControlRegister(3, (size_t) KernelAddressSpace.PML4);
SerialPrintf("[ Mem] Attempting to jump into our new pagetables: %d\r\n", (size_t) KernelAddressSpace.PML4);
WriteControlRegister(3, (size_t) KernelAddressSpace.PML4 & STACK_TOP);
SerialPrintf("[ Mem] Worked\r\n");
for(;;) {}
}

View File

@ -22,7 +22,7 @@ void StackTrace(size_t cycles) {
__asm__ __volatile__ ("mov %%rbp, %[dest]" : [dest] "=r" (stack) : :);
SerialPrintf("[Trace] Beginning stack trace. RBP is currently 0x%p\r\n", stack);
for(size_t frame = 0; stack != 0 && frame < cycles; ++frame) {
SerialPrintf("[Trace] 0x%p \r\n", stack->rip);
SerialPrintf("[Trace] (%d) 0x%p: 0x%p \r\n", frame, stack->rbp, stack->rip);
stack = stack->rbp;
}
SerialPrintf("[Trace] Stack trace over.\r\n");