diff options
author | Lioncash <mathew1800@gmail.com> | 2018-10-18 04:39:21 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2018-10-18 08:01:21 +0200 |
commit | 33830aa65ac58a03a91de9ac4fc8d91fe28f6d4e (patch) | |
tree | 54ec4efc8021d87b2d5110c9aa047d5a8f5d3fe0 /src/core/hle/kernel/vm_manager.cpp | |
parent | Merge pull request #1444 from ogniK5377/better-hid (diff) | |
download | yuzu-33830aa65ac58a03a91de9ac4fc8d91fe28f6d4e.tar yuzu-33830aa65ac58a03a91de9ac4fc8d91fe28f6d4e.tar.gz yuzu-33830aa65ac58a03a91de9ac4fc8d91fe28f6d4e.tar.bz2 yuzu-33830aa65ac58a03a91de9ac4fc8d91fe28f6d4e.tar.lz yuzu-33830aa65ac58a03a91de9ac4fc8d91fe28f6d4e.tar.xz yuzu-33830aa65ac58a03a91de9ac4fc8d91fe28f6d4e.tar.zst yuzu-33830aa65ac58a03a91de9ac4fc8d91fe28f6d4e.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/vm_manager.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/core/hle/kernel/vm_manager.cpp b/src/core/hle/kernel/vm_manager.cpp index 1e28ccbda..e1a34eef1 100644 --- a/src/core/hle/kernel/vm_manager.cpp +++ b/src/core/hle/kernel/vm_manager.cpp @@ -507,6 +507,26 @@ u64 VMManager::GetASLRRegionSize() const { return aslr_region_end - aslr_region_base; } +bool VMManager::IsWithinASLRRegion(VAddr begin, u64 size) const { + const VAddr range_end = begin + size; + const VAddr aslr_start = GetASLRRegionBaseAddress(); + const VAddr aslr_end = GetASLRRegionEndAddress(); + + if (aslr_start > begin || begin > range_end || range_end - 1 > aslr_end - 1) { + return false; + } + + if (range_end > heap_region_base && heap_region_end > begin) { + return false; + } + + if (range_end > map_region_base && map_region_end > begin) { + return false; + } + + return true; +} + VAddr VMManager::GetCodeRegionBaseAddress() const { return code_region_base; } |