mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-14 07:04:24 -04:00
kern: implement PermissionLock, update KPageTableBase attribute/alignment checks
This commit is contained in:
parent
777b6d285c
commit
ad5bd81d3f
5 changed files with 114 additions and 20 deletions
|
@ -58,10 +58,13 @@ namespace ams::kern::svc {
|
|||
R_UNLESS((address < address + size), svc::ResultInvalidCurrentMemory());
|
||||
|
||||
/* Validate the attribute and mask. */
|
||||
constexpr u32 SupportedMask = ams::svc::MemoryAttribute_Uncached;
|
||||
constexpr u32 SupportedMask = ams::svc::MemoryAttribute_Uncached | ams::svc::MemoryAttribute_PermissionLocked;
|
||||
R_UNLESS((mask | attr) == mask, svc::ResultInvalidCombination());
|
||||
R_UNLESS((mask | attr | SupportedMask) == SupportedMask, svc::ResultInvalidCombination());
|
||||
|
||||
/* Check that permission locked is either being set or not masked. */
|
||||
R_UNLESS((mask & ams::svc::MemoryAttribute_PermissionLocked) == (attr & ams::svc::MemoryAttribute_PermissionLocked), svc::ResultInvalidCombination());
|
||||
|
||||
/* Validate that the region is in range for the current process. */
|
||||
auto &page_table = GetCurrentProcess().GetPageTable();
|
||||
R_UNLESS(page_table.Contains(address, size), svc::ResultInvalidCurrentMemory());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue