diff options
author | Liam <byteslice@airmail.cc> | 2023-10-11 17:39:09 +0200 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2023-10-20 08:34:15 +0200 |
commit | 0441853d0f82ce244f2fa1dec61f64e86304e636 (patch) | |
tree | a2c3bdc51de4d56fe197431921dab862091a0a41 /src/core/hle/kernel/svc/svc_memory.cpp | |
parent | k_page_table: add new CheckMemoryState helper (diff) | |
download | yuzu-0441853d0f82ce244f2fa1dec61f64e86304e636.tar yuzu-0441853d0f82ce244f2fa1dec61f64e86304e636.tar.gz yuzu-0441853d0f82ce244f2fa1dec61f64e86304e636.tar.bz2 yuzu-0441853d0f82ce244f2fa1dec61f64e86304e636.tar.lz yuzu-0441853d0f82ce244f2fa1dec61f64e86304e636.tar.xz yuzu-0441853d0f82ce244f2fa1dec61f64e86304e636.tar.zst yuzu-0441853d0f82ce244f2fa1dec61f64e86304e636.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/svc/svc_memory.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/core/hle/kernel/svc/svc_memory.cpp b/src/core/hle/kernel/svc/svc_memory.cpp index 2cab74127..372684094 100644 --- a/src/core/hle/kernel/svc/svc_memory.cpp +++ b/src/core/hle/kernel/svc/svc_memory.cpp @@ -108,10 +108,16 @@ Result SetMemoryAttribute(Core::System& system, u64 address, u64 size, u32 mask, R_UNLESS((address < address + size), ResultInvalidCurrentMemory); // Validate the attribute and mask. - constexpr u32 SupportedMask = static_cast<u32>(MemoryAttribute::Uncached); + constexpr u32 SupportedMask = + static_cast<u32>(MemoryAttribute::Uncached | MemoryAttribute::PermissionLocked); R_UNLESS((mask | attr) == mask, ResultInvalidCombination); R_UNLESS((mask | attr | SupportedMask) == SupportedMask, ResultInvalidCombination); + // Check that permission locked is either being set or not masked. + R_UNLESS((static_cast<Svc::MemoryAttribute>(mask) & Svc::MemoryAttribute::PermissionLocked) == + (static_cast<Svc::MemoryAttribute>(attr) & Svc::MemoryAttribute::PermissionLocked), + ResultInvalidCombination); + // Validate that the region is in range for the current process. auto& page_table{GetCurrentProcess(system.Kernel()).GetPageTable()}; R_UNLESS(page_table.Contains(address, size), ResultInvalidCurrentMemory); |