aboutsummaryrefslogtreecommitdiff
path: root/ChocolArm64/Memory
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-02-25 22:53:01 -0300
committergdkchan <gab.dark.100@gmail.com>2018-02-25 22:53:01 -0300
commitf6dc86c6a097f305701af32e77a2d8995a4385cc (patch)
tree743c44b755d5df69783d040f45f76c92db06f53f /ChocolArm64/Memory
parent13214ffa43f65686a9a5a99ca1c78b6c405a34db (diff)
Implement SvcSetMemoryAttribute
Diffstat (limited to 'ChocolArm64/Memory')
-rw-r--r--ChocolArm64/Memory/AMemoryMgr.cs30
1 files changed, 30 insertions, 0 deletions
diff --git a/ChocolArm64/Memory/AMemoryMgr.cs b/ChocolArm64/Memory/AMemoryMgr.cs
index 05284059..c8869e03 100644
--- a/ChocolArm64/Memory/AMemoryMgr.cs
+++ b/ChocolArm64/Memory/AMemoryMgr.cs
@@ -234,6 +234,36 @@ namespace ChocolArm64.Memory
BaseEntry.Perm);
}
+ public void ClearAttrBit(long Position, long Size, int Bit)
+ {
+ while (Size > 0)
+ {
+ PTEntry Entry = GetPTEntry(Position);
+
+ Entry.Attr &= ~(1 << Bit);
+
+ SetPTEntry(Position, Entry);
+
+ Position += PageSize;
+ Size -= PageSize;
+ }
+ }
+
+ public void SetAttrBit(long Position, long Size, int Bit)
+ {
+ while (Size > 0)
+ {
+ PTEntry Entry = GetPTEntry(Position);
+
+ Entry.Attr |= (1 << Bit);
+
+ SetPTEntry(Position, Entry);
+
+ Position += PageSize;
+ Size -= PageSize;
+ }
+ }
+
public bool HasPermission(long Position, AMemoryPerm Perm)
{
return GetPTEntry(Position).Perm.HasFlag(Perm);