aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Memory/Tracking/MemoryTracking.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Memory/Tracking/MemoryTracking.cs')
-rw-r--r--Ryujinx.Memory/Tracking/MemoryTracking.cs17
1 files changed, 14 insertions, 3 deletions
diff --git a/Ryujinx.Memory/Tracking/MemoryTracking.cs b/Ryujinx.Memory/Tracking/MemoryTracking.cs
index ed3d7e38..aa7f9a6c 100644
--- a/Ryujinx.Memory/Tracking/MemoryTracking.cs
+++ b/Ryujinx.Memory/Tracking/MemoryTracking.cs
@@ -190,12 +190,15 @@ namespace Ryujinx.Memory.Tracking
/// <summary>
/// Signal that a virtual memory event happened at the given location.
+ /// This can be flagged as a precise event, which will avoid reprotection and call special handlers if possible.
+ /// A precise event has an exact address and size, rather than triggering on page granularity.
/// </summary>
/// <param name="address">Virtual address accessed</param>
/// <param name="size">Size of the region affected in bytes</param>
/// <param name="write">Whether the region was written to or read</param>
+ /// <param name="precise">True if the access is precise, false otherwise</param>
/// <returns>True if the event triggered any tracking regions, false otherwise</returns>
- public bool VirtualMemoryEvent(ulong address, ulong size, bool write)
+ public bool VirtualMemoryEvent(ulong address, ulong size, bool write, bool precise = false)
{
// Look up the virtual region using the region list.
// Signal up the chain to relevant handles.
@@ -206,7 +209,7 @@ namespace Ryujinx.Memory.Tracking
int count = _virtualRegions.FindOverlapsNonOverlapping(address, size, ref overlaps);
- if (count == 0)
+ if (count == 0 && !precise)
{
if (!_memoryManager.IsMapped(address))
{
@@ -224,7 +227,15 @@ namespace Ryujinx.Memory.Tracking
for (int i = 0; i < count; i++)
{
VirtualRegion region = overlaps[i];
- region.Signal(address, size, write);
+
+ if (precise)
+ {
+ region.SignalPrecise(address, size, write);
+ }
+ else
+ {
+ region.Signal(address, size, write);
+ }
}
}