aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTableBase.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2024-01-03 20:05:14 -0300
committerGitHub <noreply@github.com>2024-01-04 00:05:14 +0100
commit6f50b9bdb0943c350835453e97b02be52ad39bfd (patch)
tree37d4de58dbc86e4eaa5488d53029d908b1b41731 /src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTableBase.cs
parentf11d663df73f68350820dfa65aa51a8a9b9ffd0f (diff)
Add support for PermissionLocked attribute added on firmware 17.0.0 (#6072)1.1.1103
* Update MemoryState enum and add new flags * Add support for new PermissionLocked attribute added on firmware 17.0.0 * Format whitespace
Diffstat (limited to 'src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTableBase.cs')
-rw-r--r--src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTableBase.cs26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTableBase.cs b/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTableBase.cs
index 2b6d4e4e..b065e9c5 100644
--- a/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTableBase.cs
+++ b/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTableBase.cs
@@ -675,7 +675,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
KMemoryPermission.None,
MemoryAttribute.Mask,
MemoryAttribute.None,
- MemoryAttribute.IpcAndDeviceMapped,
+ MemoryAttribute.IpcAndDeviceMapped | MemoryAttribute.PermissionLocked,
out MemoryState state,
out _,
out _);
@@ -687,7 +687,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
state,
KMemoryPermission.None,
KMemoryPermission.None,
- MemoryAttribute.Mask,
+ MemoryAttribute.Mask & ~MemoryAttribute.PermissionLocked,
MemoryAttribute.None);
if (success)
@@ -913,19 +913,27 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
return Result.Success;
}
- public Result SetMemoryAttribute(
- ulong address,
- ulong size,
- MemoryAttribute attributeMask,
- MemoryAttribute attributeValue)
+ public Result SetMemoryAttribute(ulong address, ulong size, MemoryAttribute attributeMask, MemoryAttribute attributeValue)
{
lock (_blockManager)
{
+ MemoryState stateCheckMask = 0;
+
+ if (attributeMask.HasFlag(MemoryAttribute.Uncached))
+ {
+ stateCheckMask = MemoryState.AttributeChangeAllowed;
+ }
+
+ if (attributeMask.HasFlag(MemoryAttribute.PermissionLocked))
+ {
+ stateCheckMask |= MemoryState.PermissionLockAllowed;
+ }
+
if (CheckRange(
address,
size,
- MemoryState.AttributeChangeAllowed,
- MemoryState.AttributeChangeAllowed,
+ stateCheckMask,
+ stateCheckMask,
KMemoryPermission.None,
KMemoryPermission.None,
MemoryAttribute.BorrowedAndIpcMapped,