summaryrefslogtreecommitdiffstats
path: root/src/core/memory.cpp
diff options
context:
space:
mode:
authorJames Rowe <jroweboy@gmail.com>2016-11-24 20:42:32 +0100
committerJames Rowe <jroweboy@gmail.com>2016-11-25 04:41:18 +0100
commitbbe57a66cad1b4159f351bf55f84c97040b04753 (patch)
treea2643734bf9af63e5a8f44ff7207e6f8848267f0 /src/core/memory.cpp
parentCache Vertices instead of Output registers (#2165) (diff)
downloadyuzu-bbe57a66cad1b4159f351bf55f84c97040b04753.tar
yuzu-bbe57a66cad1b4159f351bf55f84c97040b04753.tar.gz
yuzu-bbe57a66cad1b4159f351bf55f84c97040b04753.tar.bz2
yuzu-bbe57a66cad1b4159f351bf55f84c97040b04753.tar.lz
yuzu-bbe57a66cad1b4159f351bf55f84c97040b04753.tar.xz
yuzu-bbe57a66cad1b4159f351bf55f84c97040b04753.tar.zst
yuzu-bbe57a66cad1b4159f351bf55f84c97040b04753.zip
Diffstat (limited to '')
-rw-r--r--src/core/memory.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/core/memory.cpp b/src/core/memory.cpp
index 64c388374..65e4bba85 100644
--- a/src/core/memory.cpp
+++ b/src/core/memory.cpp
@@ -45,13 +45,11 @@ struct SpecialRegion {
* requires an indexed fetch and a check for NULL.
*/
struct PageTable {
- static const size_t NUM_ENTRIES = 1 << (32 - PAGE_BITS);
-
/**
* Array of memory pointers backing each page. An entry can only be non-null if the
* corresponding entry in the `attributes` array is of type `Memory`.
*/
- std::array<u8*, NUM_ENTRIES> pointers;
+ std::array<u8*, PAGE_TABLE_NUM_ENTRIES> pointers;
/**
* Contains MMIO handlers that back memory regions whose entries in the `attribute` array is of
@@ -63,13 +61,13 @@ struct PageTable {
* Array of fine grained page attributes. If it is set to any value other than `Memory`, then
* the corresponding entry in `pointers` MUST be set to null.
*/
- std::array<PageType, NUM_ENTRIES> attributes;
+ std::array<PageType, PAGE_TABLE_NUM_ENTRIES> attributes;
/**
* Indicates the number of externally cached resources touching a page that should be
* flushed before the memory is accessed
*/
- std::array<u8, NUM_ENTRIES> cached_res_count;
+ std::array<u8, PAGE_TABLE_NUM_ENTRIES> cached_res_count;
};
/// Singular page table used for the singleton process
@@ -77,6 +75,10 @@ static PageTable main_page_table;
/// Currently active page table
static PageTable* current_page_table = &main_page_table;
+std::array<u8*, PAGE_TABLE_NUM_ENTRIES>* GetCurrentPageTablePointers() {
+ return &current_page_table->pointers;
+}
+
static void MapPages(u32 base, u32 size, u8* memory, PageType type) {
LOG_DEBUG(HW_Memory, "Mapping %p onto %08X-%08X", memory, base * PAGE_SIZE,
(base + size) * PAGE_SIZE);
@@ -84,7 +86,7 @@ static void MapPages(u32 base, u32 size, u8* memory, PageType type) {
u32 end = base + size;
while (base != end) {
- ASSERT_MSG(base < PageTable::NUM_ENTRIES, "out of range mapping at %08X", base);
+ ASSERT_MSG(base < PAGE_TABLE_NUM_ENTRIES, "out of range mapping at %08X", base);
// Since pages are unmapped on shutdown after video core is shutdown, the renderer may be
// null here