summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/svc
diff options
context:
space:
mode:
authorGravatar Liam2023-10-11 11:39:09 -0400
committerGravatar Liam2023-10-20 02:34:15 -0400
commit0441853d0f82ce244f2fa1dec61f64e86304e636 (patch)
treea2c3bdc51de4d56fe197431921dab862091a0a41 /src/core/hle/kernel/svc
parentk_page_table: add new CheckMemoryState helper (diff)
downloadyuzu-0441853d0f82ce244f2fa1dec61f64e86304e636.tar.gz
yuzu-0441853d0f82ce244f2fa1dec61f64e86304e636.tar.xz
yuzu-0441853d0f82ce244f2fa1dec61f64e86304e636.zip
k_page_table: implement PermissionLocked
Diffstat (limited to 'src/core/hle/kernel/svc')
-rw-r--r--src/core/hle/kernel/svc/svc_memory.cpp8
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,
108 R_UNLESS((address < address + size), ResultInvalidCurrentMemory); 108 R_UNLESS((address < address + size), ResultInvalidCurrentMemory);
109 109
110 // Validate the attribute and mask. 110 // Validate the attribute and mask.
111 constexpr u32 SupportedMask = static_cast<u32>(MemoryAttribute::Uncached); 111 constexpr u32 SupportedMask =
112 static_cast<u32>(MemoryAttribute::Uncached | MemoryAttribute::PermissionLocked);
112 R_UNLESS((mask | attr) == mask, ResultInvalidCombination); 113 R_UNLESS((mask | attr) == mask, ResultInvalidCombination);
113 R_UNLESS((mask | attr | SupportedMask) == SupportedMask, ResultInvalidCombination); 114 R_UNLESS((mask | attr | SupportedMask) == SupportedMask, ResultInvalidCombination);
114 115
116 // Check that permission locked is either being set or not masked.
117 R_UNLESS((static_cast<Svc::MemoryAttribute>(mask) & Svc::MemoryAttribute::PermissionLocked) ==
118 (static_cast<Svc::MemoryAttribute>(attr) & Svc::MemoryAttribute::PermissionLocked),
119 ResultInvalidCombination);
120
115 // Validate that the region is in range for the current process. 121 // Validate that the region is in range for the current process.
116 auto& page_table{GetCurrentProcess(system.Kernel()).GetPageTable()}; 122 auto& page_table{GetCurrentProcess(system.Kernel()).GetPageTable()};
117 R_UNLESS(page_table.Contains(address, size), ResultInvalidCurrentMemory); 123 R_UNLESS(page_table.Contains(address, size), ResultInvalidCurrentMemory);