From f6dc86c6a097f305701af32e77a2d8995a4385cc Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sun, 25 Feb 2018 22:53:01 -0300 Subject: Implement SvcSetMemoryAttribute --- ChocolArm64/Memory/AMemoryMgr.cs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'ChocolArm64/Memory') 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); -- cgit v1.2.3