aboutsummaryrefslogtreecommitdiff
path: root/ChocolArm64
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-10-20 19:07:52 -0300
committerAc_K <Acoustik666@gmail.com>2018-10-20 22:07:52 +0000
commit2cb8541462e3cc31e9a4ffe63f430168c0c747d1 (patch)
treefa334b97c96e4541cf3bd6bc0913c70d57c4370d /ChocolArm64
parent0e1e094b7a8f0134831fc4cebdb0841b9c10fe6a (diff)
Print stack trace on invalid memory accesses (#461)
* Print stack trace on invalid memory accesses * Rebased, change code region base address for 39-bits address space, print stack trace on break and undefined instructions too
Diffstat (limited to 'ChocolArm64')
-rw-r--r--ChocolArm64/Events/AInvalidAccessEventArgs.cs14
-rw-r--r--ChocolArm64/Memory/AMemory.cs7
2 files changed, 21 insertions, 0 deletions
diff --git a/ChocolArm64/Events/AInvalidAccessEventArgs.cs b/ChocolArm64/Events/AInvalidAccessEventArgs.cs
new file mode 100644
index 00000000..a5c472a8
--- /dev/null
+++ b/ChocolArm64/Events/AInvalidAccessEventArgs.cs
@@ -0,0 +1,14 @@
+using System;
+
+namespace ChocolArm64.Events
+{
+ public class AInvalidAccessEventArgs : EventArgs
+ {
+ public long Position { get; private set; }
+
+ public AInvalidAccessEventArgs(long Position)
+ {
+ this.Position = Position;
+ }
+ }
+} \ No newline at end of file
diff --git a/ChocolArm64/Memory/AMemory.cs b/ChocolArm64/Memory/AMemory.cs
index bb6a2b54..2854871e 100644
--- a/ChocolArm64/Memory/AMemory.cs
+++ b/ChocolArm64/Memory/AMemory.cs
@@ -1,3 +1,4 @@
+using ChocolArm64.Events;
using ChocolArm64.Exceptions;
using ChocolArm64.State;
using System;
@@ -51,6 +52,8 @@ namespace ChocolArm64.Memory
private byte*** PageTable;
+ public event EventHandler<AInvalidAccessEventArgs> InvalidAccess;
+
public AMemory(IntPtr Ram)
{
Monitors = new Dictionary<int, ArmMonitor>();
@@ -512,6 +515,8 @@ Unmapped:
return (byte*)Ptr + (Position & PageMask);
}
+ InvalidAccess?.Invoke(this, new AInvalidAccessEventArgs(Position));
+
throw new VmmPageFaultException(Position);
}
@@ -560,6 +565,8 @@ Unmapped:
return (byte*)Ptr + (Position & PageMask);
}
+ InvalidAccess?.Invoke(this, new AInvalidAccessEventArgs(Position));
+
throw new VmmPageFaultException(Position);
}