summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnnomatg <47226753+Annomatg@users.noreply.github.com>2019-02-27 23:22:47 +0100
committerbunnei <bunneidev@gmail.com>2019-02-27 23:22:47 +0100
commitef84c70d222eb2b8ea56e67b793cc459b90cdd74 (patch)
tree0a8df14569fbdf75cffa029859000cd0b6e11934
parentMerge pull request #2176 from lioncash/com (diff)
downloadyuzu-ef84c70d222eb2b8ea56e67b793cc459b90cdd74.tar
yuzu-ef84c70d222eb2b8ea56e67b793cc459b90cdd74.tar.gz
yuzu-ef84c70d222eb2b8ea56e67b793cc459b90cdd74.tar.bz2
yuzu-ef84c70d222eb2b8ea56e67b793cc459b90cdd74.tar.lz
yuzu-ef84c70d222eb2b8ea56e67b793cc459b90cdd74.tar.xz
yuzu-ef84c70d222eb2b8ea56e67b793cc459b90cdd74.tar.zst
yuzu-ef84c70d222eb2b8ea56e67b793cc459b90cdd74.zip
-rw-r--r--src/core/memory.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/core/memory.cpp b/src/core/memory.cpp
index e9166dbd9..f809567b6 100644
--- a/src/core/memory.cpp
+++ b/src/core/memory.cpp
@@ -71,15 +71,20 @@ static void MapPages(PageTable& page_table, VAddr base, u64 size, u8* memory, Pa
FlushMode::FlushAndInvalidate);
VAddr end = base + size;
- while (base != end) {
- ASSERT_MSG(base < page_table.pointers.size(), "out of range mapping at {:016X}", base);
+ ASSERT_MSG(end <= page_table.pointers.size(), "out of range mapping at {:016X}",
+ base + page_table.pointers.size());
- page_table.attributes[base] = type;
- page_table.pointers[base] = memory;
+ std::fill(page_table.attributes.begin() + base, page_table.attributes.begin() + end, type);
- base += 1;
- if (memory != nullptr)
+ 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;
+
+ base += 1;
memory += PAGE_SIZE;
+ }
}
}