Code: Select all
void Kernel::Memory::PageFault(unsigned int error)
{
unsigned long* address = read_cr2();
PageDirectory pageDir(read_cr3());
if (!pageDir.GetPageTable(address))
{
PageTable pageTable;
pageTable.SetEntry(address, (unsigned long*)Physical::AllocatePage());
pageDir.SetPageTable(address, pageTable.GetAddress());
}
else
{
PageTable pageTable((unsigned long*)pageDir.GetPageTable(address));
pageTable.SetEntry(address, (unsigned long*)Physical::AllocatePage());
}
}
Code: Select all
unsigned long* p = (unsigned long*)0x700000;
*p = 4;
*p = 4;
Integer x(*p);
console.WriteLine(x); //prints 4
Code: Select all
unsigned long* p = (unsigned long*)0x700000;
*p = 4;
Integer x(*p);
console.WriteLine(x); //prints 41951232