From 42a7c5d017a3a6bb5e6ed1b51b955ea3d756eead Mon Sep 17 00:00:00 2001
From: Markus Wick <markus@selfnet.de>
Date: Sat, 29 May 2021 09:24:09 +0200
Subject: core/memory: Check our memory fallbacks for out-of-bound behavior.

This makes it by far harder to crash yuzu.

Also implement the 48bit masking of AARCH64 while touching this code.
---
 src/common/page_table.h | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'src/common/page_table.h')

diff --git a/src/common/page_table.h b/src/common/page_table.h
index 61c5552e09..e92b66b2b0 100644
--- a/src/common/page_table.h
+++ b/src/common/page_table.h
@@ -98,6 +98,10 @@ struct PageTable {
      */
     void Resize(size_t address_space_width_in_bits, size_t page_size_in_bits);
 
+    size_t GetAddressSpaceBits() const {
+        return current_address_space_width_in_bits;
+    }
+
     /**
      * Vector of memory pointers backing each page. An entry can only be non-null if the
      * corresponding attribute element is of type `Memory`.
@@ -105,6 +109,8 @@ struct PageTable {
     VirtualBuffer<PageInfo> pointers;
 
     VirtualBuffer<u64> backing_addr;
+
+    size_t current_address_space_width_in_bits;
 };
 
 } // namespace Common
-- 
cgit v1.2.3-70-g09d2