summaryrefslogtreecommitdiff
path: root/src/core/memory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/memory.cpp')
-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: