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
This commit is contained in:
parent
9533b338ac
commit
374e660b78
2 changed files with 21 additions and 0 deletions
14
Events/AInvalidAccessEventArgs.cs
Normal file
14
Events/AInvalidAccessEventArgs.cs
Normal file
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
|
using ChocolArm64.Events;
|
||||||
using ChocolArm64.Exceptions;
|
using ChocolArm64.Exceptions;
|
||||||
using ChocolArm64.State;
|
using ChocolArm64.State;
|
||||||
using System;
|
using System;
|
||||||
|
@ -51,6 +52,8 @@ namespace ChocolArm64.Memory
|
||||||
|
|
||||||
private byte*** PageTable;
|
private byte*** PageTable;
|
||||||
|
|
||||||
|
public event EventHandler<AInvalidAccessEventArgs> InvalidAccess;
|
||||||
|
|
||||||
public AMemory(IntPtr Ram)
|
public AMemory(IntPtr Ram)
|
||||||
{
|
{
|
||||||
Monitors = new Dictionary<int, ArmMonitor>();
|
Monitors = new Dictionary<int, ArmMonitor>();
|
||||||
|
@ -512,6 +515,8 @@ Unmapped:
|
||||||
return (byte*)Ptr + (Position & PageMask);
|
return (byte*)Ptr + (Position & PageMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InvalidAccess?.Invoke(this, new AInvalidAccessEventArgs(Position));
|
||||||
|
|
||||||
throw new VmmPageFaultException(Position);
|
throw new VmmPageFaultException(Position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -560,6 +565,8 @@ Unmapped:
|
||||||
return (byte*)Ptr + (Position & PageMask);
|
return (byte*)Ptr + (Position & PageMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InvalidAccess?.Invoke(this, new AInvalidAccessEventArgs(Position));
|
||||||
|
|
||||||
throw new VmmPageFaultException(Position);
|
throw new VmmPageFaultException(Position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue