diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2018-07-08 16:55:15 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-08 16:55:15 -0300 |
| commit | 095db47e132a475e25d128e691ebdae101611cc9 (patch) | |
| tree | f10299c8168709bf8db7f2da966eb0cbe6b598a9 /ChocolArm64/Memory/AMemoryWin32.cs | |
| parent | 0f8f40486d1b3215c845325744bd545149223805 (diff) | |
Query multiple pages at once with GetWriteWatch (#222)
* Query multiple pages at once with GetWriteWatch
* Allow multiple buffer types to share the same page, aways use the physical address as cache key
* Remove a variable that is no longer needed
Diffstat (limited to 'ChocolArm64/Memory/AMemoryWin32.cs')
| -rw-r--r-- | ChocolArm64/Memory/AMemoryWin32.cs | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/ChocolArm64/Memory/AMemoryWin32.cs b/ChocolArm64/Memory/AMemoryWin32.cs index d097dc87..387ca32c 100644 --- a/ChocolArm64/Memory/AMemoryWin32.cs +++ b/ChocolArm64/Memory/AMemoryWin32.cs @@ -49,7 +49,7 @@ namespace ChocolArm64.Memory VirtualFree(Address, IntPtr.Zero, MEM_RELEASE); } - public unsafe static long IsRegionModified(IntPtr Address, IntPtr Size, bool Reset) + public unsafe static int GetPageSize(IntPtr Address, IntPtr Size) { IntPtr[] Addresses = new IntPtr[1]; @@ -57,17 +57,36 @@ namespace ChocolArm64.Memory long Granularity; - int Flags = Reset ? WRITE_WATCH_FLAG_RESET : 0; + GetWriteWatch( + 0, + Address, + Size, + Addresses, + &Count, + &Granularity); + + return (int)Granularity; + } + + public unsafe static void IsRegionModified( + IntPtr Address, + IntPtr Size, + IntPtr[] Addresses, + out int AddrCount) + { + long Count = Addresses.Length; + + long Granularity; GetWriteWatch( - Flags, + WRITE_WATCH_FLAG_RESET, Address, Size, Addresses, &Count, &Granularity); - return Count != 0 ? Granularity : 0; + AddrCount = (int)Count; } } }
\ No newline at end of file |
