diff options
author | Lioncash <mathew1800@gmail.com> | 2018-12-15 19:49:40 +0100 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2018-12-19 16:59:36 +0100 |
commit | 603cc72168b2165a0aa77a39a14ca63a879cf8f9 (patch) | |
tree | b6e8f3b8a53739c2ffdc857017666ad7e3b53188 /src/core/hle/kernel/vm_manager.h | |
parent | vm_manager: Rename meminfo_state to state (diff) | |
download | yuzu-603cc72168b2165a0aa77a39a14ca63a879cf8f9.tar yuzu-603cc72168b2165a0aa77a39a14ca63a879cf8f9.tar.gz yuzu-603cc72168b2165a0aa77a39a14ca63a879cf8f9.tar.bz2 yuzu-603cc72168b2165a0aa77a39a14ca63a879cf8f9.tar.lz yuzu-603cc72168b2165a0aa77a39a14ca63a879cf8f9.tar.xz yuzu-603cc72168b2165a0aa77a39a14ca63a879cf8f9.tar.zst yuzu-603cc72168b2165a0aa77a39a14ca63a879cf8f9.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/vm_manager.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/core/hle/kernel/vm_manager.h b/src/core/hle/kernel/vm_manager.h index e2614cd4c..9fa9a18fb 100644 --- a/src/core/hle/kernel/vm_manager.h +++ b/src/core/hle/kernel/vm_manager.h @@ -6,6 +6,7 @@ #include <map> #include <memory> +#include <tuple> #include <vector> #include "common/common_types.h" #include "core/hle/result.h" @@ -256,6 +257,16 @@ struct PageInfo { * also backed by a single host memory allocation. */ struct VirtualMemoryArea { + /// Gets the starting (base) address of this VMA. + VAddr StartAddress() const { + return base; + } + + /// Gets the ending address of this VMA. + VAddr EndAddress() const { + return base + size - 1; + } + /// Virtual base address of the region. VAddr base = 0; /// Size of the region. @@ -517,6 +528,35 @@ private: /// Clears out the page table void ClearPageTable(); + using CheckResults = ResultVal<std::tuple<MemoryState, VMAPermission, MemoryAttribute>>; + + /// Checks if an address range adheres to the specified states provided. + /// + /// @param address The starting address of the address range. + /// @param size The size of the address range. + /// @param state_mask The memory state mask. + /// @param state The state to compare the individual VMA states against, + /// which is done in the form of: (vma.state & state_mask) != state. + /// @param permission_mask The memory permissions mask. + /// @param permissions The permission to compare the individual VMA permissions against, + /// which is done in the form of: + /// (vma.permission & permission_mask) != permission. + /// @param attribute_mask The memory attribute mask. + /// @param attribute The memory attributes to compare the individual VMA attributes + /// against, which is done in the form of: + /// (vma.attributes & attribute_mask) != attribute. + /// @param ignore_mask The memory attributes to ignore during the check. + /// + /// @returns If successful, returns a tuple containing the memory attributes + /// (with ignored bits specified by ignore_mask unset), memory permissions, and + /// memory state across the memory range. + /// @returns If not successful, returns ERR_INVALID_ADDRESS_STATE. + /// + CheckResults CheckRangeState(VAddr address, u64 size, MemoryState state_mask, MemoryState state, + VMAPermission permission_mask, VMAPermission permissions, + MemoryAttribute attribute_mask, MemoryAttribute attribute, + MemoryAttribute ignore_mask) const; + /** * A map covering the entirety of the managed address space, keyed by the `base` field of each * VMA. It must always be modified by splitting or merging VMAs, so that the invariant |