summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar MerryMage2018-02-21 20:03:56 +0000
committerGravatar MerryMage2018-02-21 21:39:07 +0000
commitcc368de1a0cf148409cc4b55cf6e616114ebf76d (patch)
treefdea8bdbb0e1137b994dc70984d39cd0436c122d
parentMerge pull request #206 from mailwl/aoc-listaddoncontent (diff)
downloadyuzu-cc368de1a0cf148409cc4b55cf6e616114ebf76d.tar.gz
yuzu-cc368de1a0cf148409cc4b55cf6e616114ebf76d.tar.xz
yuzu-cc368de1a0cf148409cc4b55cf6e616114ebf76d.zip
memory: LOG_ERROR when falling off end of page table
Diffstat (limited to '')
-rw-r--r--src/core/memory.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/memory.cpp b/src/core/memory.cpp
index cc1ed16b6..ce62666d7 100644
--- a/src/core/memory.cpp
+++ b/src/core/memory.cpp
@@ -118,6 +118,11 @@ boost::optional<T> ReadSpecial(VAddr addr);
118 118
119template <typename T> 119template <typename T>
120T Read(const VAddr vaddr) { 120T Read(const VAddr vaddr) {
121 if ((vaddr >> PAGE_BITS) >= PAGE_TABLE_NUM_ENTRIES) {
122 LOG_ERROR(HW_Memory, "Read%lu after page table @ 0x%016" PRIX64, sizeof(T) * 8, vaddr);
123 return 0;
124 }
125
121 const PageType type = current_page_table->attributes[vaddr >> PAGE_BITS]; 126 const PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
122 switch (type) { 127 switch (type) {
123 case PageType::Unmapped: 128 case PageType::Unmapped:
@@ -146,6 +151,12 @@ bool WriteSpecial(VAddr addr, const T data);
146 151
147template <typename T> 152template <typename T>
148void Write(const VAddr vaddr, const T data) { 153void Write(const VAddr vaddr, const T data) {
154 if ((vaddr >> PAGE_BITS) >= PAGE_TABLE_NUM_ENTRIES) {
155 LOG_ERROR(HW_Memory, "Write%lu after page table 0x%08X @ 0x%016" PRIX64, sizeof(data) * 8,
156 (u32)data, vaddr);
157 return;
158 }
159
149 const PageType type = current_page_table->attributes[vaddr >> PAGE_BITS]; 160 const PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
150 switch (type) { 161 switch (type) {
151 case PageType::Unmapped: 162 case PageType::Unmapped: