hle: kernel: k_page_table: Add IsHeapPhysicalAddress method.

This commit is contained in:
bunnei 2022-03-26 01:23:43 -07:00
parent f29410d821
commit c975a51ae7

View File

@ -12,6 +12,7 @@
#include "core/file_sys/program_metadata.h" #include "core/file_sys/program_metadata.h"
#include "core/hle/kernel/k_light_lock.h" #include "core/hle/kernel/k_light_lock.h"
#include "core/hle/kernel/k_memory_block.h" #include "core/hle/kernel/k_memory_block.h"
#include "core/hle/kernel/k_memory_layout.h"
#include "core/hle/kernel/k_memory_manager.h" #include "core/hle/kernel/k_memory_manager.h"
#include "core/hle/result.h" #include "core/hle/result.h"
@ -163,6 +164,12 @@ private:
return general_lock.IsLockedByCurrentThread(); return general_lock.IsLockedByCurrentThread();
} }
bool IsHeapPhysicalAddress(const KMemoryLayout& layout, PAddr phys_addr) {
ASSERT(this->IsLockedByCurrentThread());
return layout.IsHeapPhysicalAddress(cached_physical_heap_region, phys_addr);
}
mutable KLightLock general_lock; mutable KLightLock general_lock;
mutable KLightLock map_physical_memory_lock; mutable KLightLock map_physical_memory_lock;
@ -322,6 +329,7 @@ private:
bool is_aslr_enabled{}; bool is_aslr_enabled{};
u32 heap_fill_value{}; u32 heap_fill_value{};
const KMemoryRegion* cached_physical_heap_region{};
KMemoryManager::Pool memory_pool{KMemoryManager::Pool::Application}; KMemoryManager::Pool memory_pool{KMemoryManager::Pool::Application};
KMemoryManager::Direction allocation_option{KMemoryManager::Direction::FromFront}; KMemoryManager::Direction allocation_option{KMemoryManager::Direction::FromFront};