Speed up memory page mapping (#2141)
- Memory::MapPages total samplecount was reduced from 4.6% to 1.06%. - From main menu into the game from 1.03% to 0.35%
This commit is contained in:
parent
532dda0499
commit
ef84c70d22
|
@ -71,16 +71,21 @@ static void MapPages(PageTable& page_table, VAddr base, u64 size, u8* memory, Pa
|
||||||
FlushMode::FlushAndInvalidate);
|
FlushMode::FlushAndInvalidate);
|
||||||
|
|
||||||
VAddr end = base + size;
|
VAddr end = base + size;
|
||||||
while (base != end) {
|
ASSERT_MSG(end <= page_table.pointers.size(), "out of range mapping at {:016X}",
|
||||||
ASSERT_MSG(base < page_table.pointers.size(), "out of range mapping at {:016X}", base);
|
base + page_table.pointers.size());
|
||||||
|
|
||||||
page_table.attributes[base] = type;
|
std::fill(page_table.attributes.begin() + base, page_table.attributes.begin() + end, type);
|
||||||
|
|
||||||
|
if (memory == nullptr) {
|
||||||
|
std::fill(page_table.pointers.begin() + base, page_table.pointers.begin() + end, memory);
|
||||||
|
} else {
|
||||||
|
while (base != end) {
|
||||||
page_table.pointers[base] = memory;
|
page_table.pointers[base] = memory;
|
||||||
|
|
||||||
base += 1;
|
base += 1;
|
||||||
if (memory != nullptr)
|
|
||||||
memory += PAGE_SIZE;
|
memory += PAGE_SIZE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapMemoryRegion(PageTable& page_table, VAddr base, u64 size, u8* target) {
|
void MapMemoryRegion(PageTable& page_table, VAddr base, u64 size, u8* target) {
|
||||||
|
|
Loading…
Reference in a new issue