summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorMerryMage <MerryMage@users.noreply.github.com>2018-02-21 21:03:56 +0100
committerMerryMage <MerryMage@users.noreply.github.com>2018-02-21 22:39:07 +0100
commitcc368de1a0cf148409cc4b55cf6e616114ebf76d (patch)
treefdea8bdbb0e1137b994dc70984d39cd0436c122d /src/core
parentMerge pull request #206 from mailwl/aoc-listaddoncontent (diff)
downloadyuzu-cc368de1a0cf148409cc4b55cf6e616114ebf76d.tar
yuzu-cc368de1a0cf148409cc4b55cf6e616114ebf76d.tar.gz
yuzu-cc368de1a0cf148409cc4b55cf6e616114ebf76d.tar.bz2
yuzu-cc368de1a0cf148409cc4b55cf6e616114ebf76d.tar.lz
yuzu-cc368de1a0cf148409cc4b55cf6e616114ebf76d.tar.xz
yuzu-cc368de1a0cf148409cc4b55cf6e616114ebf76d.tar.zst
yuzu-cc368de1a0cf148409cc4b55cf6e616114ebf76d.zip
Diffstat (limited to 'src/core')
-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);
template <typename T>
T Read(const VAddr vaddr) {
+ if ((vaddr >> PAGE_BITS) >= PAGE_TABLE_NUM_ENTRIES) {
+ LOG_ERROR(HW_Memory, "Read%lu after page table @ 0x%016" PRIX64, sizeof(T) * 8, vaddr);
+ return 0;
+ }
+
const PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
switch (type) {
case PageType::Unmapped:
@@ -146,6 +151,12 @@ bool WriteSpecial(VAddr addr, const T data);
template <typename T>
void Write(const VAddr vaddr, const T data) {
+ if ((vaddr >> PAGE_BITS) >= PAGE_TABLE_NUM_ENTRIES) {
+ LOG_ERROR(HW_Memory, "Write%lu after page table 0x%08X @ 0x%016" PRIX64, sizeof(data) * 8,
+ (u32)data, vaddr);
+ return;
+ }
+
const PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
switch (type) {
case PageType::Unmapped: