summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/page_table.cpp1
-rw-r--r--src/common/page_table.h6
2 files changed, 7 insertions, 0 deletions
diff --git a/src/common/page_table.cpp b/src/common/page_table.cpp
index 8fd8620fd..9fffd816f 100644
--- a/src/common/page_table.cpp
+++ b/src/common/page_table.cpp
@@ -14,6 +14,7 @@ void PageTable::Resize(size_t address_space_width_in_bits, size_t page_size_in_b
14 const size_t num_page_table_entries{1ULL << (address_space_width_in_bits - page_size_in_bits)}; 14 const size_t num_page_table_entries{1ULL << (address_space_width_in_bits - page_size_in_bits)};
15 pointers.resize(num_page_table_entries); 15 pointers.resize(num_page_table_entries);
16 backing_addr.resize(num_page_table_entries); 16 backing_addr.resize(num_page_table_entries);
17 current_address_space_width_in_bits = address_space_width_in_bits;
17} 18}
18 19
19} // namespace Common 20} // namespace Common
diff --git a/src/common/page_table.h b/src/common/page_table.h
index 61c5552e0..e92b66b2b 100644
--- a/src/common/page_table.h
+++ b/src/common/page_table.h
@@ -98,6 +98,10 @@ struct PageTable {
98 */ 98 */
99 void Resize(size_t address_space_width_in_bits, size_t page_size_in_bits); 99 void Resize(size_t address_space_width_in_bits, size_t page_size_in_bits);
100 100
101 size_t GetAddressSpaceBits() const {
102 return current_address_space_width_in_bits;
103 }
104
101 /** 105 /**
102 * Vector of memory pointers backing each page. An entry can only be non-null if the 106 * Vector of memory pointers backing each page. An entry can only be non-null if the
103 * corresponding attribute element is of type `Memory`. 107 * corresponding attribute element is of type `Memory`.
@@ -105,6 +109,8 @@ struct PageTable {
105 VirtualBuffer<PageInfo> pointers; 109 VirtualBuffer<PageInfo> pointers;
106 110
107 VirtualBuffer<u64> backing_addr; 111 VirtualBuffer<u64> backing_addr;
112
113 size_t current_address_space_width_in_bits;
108}; 114};
109 115
110} // namespace Common 116} // namespace Common