1
0
Fork 0
forked from suyu/suyu

memory: Set page-table pointers before setting attribute = Memory

This commit is contained in:
MerryMage 2020-07-05 11:25:08 +01:00
parent 52882a93a5
commit 76bd617b2d

View file

@ -548,9 +548,9 @@ struct Memory::Impl {
// longer exist, and we should just leave the pagetable entry blank. // longer exist, and we should just leave the pagetable entry blank.
page_type = Common::PageType::Unmapped; page_type = Common::PageType::Unmapped;
} else { } else {
page_type = Common::PageType::Memory;
current_page_table->pointers[vaddr >> PAGE_BITS] = current_page_table->pointers[vaddr >> PAGE_BITS] =
pointer - (vaddr & ~PAGE_MASK); pointer - (vaddr & ~PAGE_MASK);
page_type = Common::PageType::Memory;
} }
break; break;
} }
@ -591,9 +591,12 @@ struct Memory::Impl {
base + page_table.pointers.size()); base + page_table.pointers.size());
if (!target) { if (!target) {
ASSERT_MSG(type != Common::PageType::Memory,
"Mapping memory page without a pointer @ {:016x}", base * PAGE_SIZE);
while (base != end) { while (base != end) {
page_table.pointers[base] = nullptr;
page_table.attributes[base] = type; page_table.attributes[base] = type;
page_table.pointers[base] = nullptr;
page_table.backing_addr[base] = 0; page_table.backing_addr[base] = 0;
base += 1; base += 1;