aboutsummaryrefslogtreecommitdiff
path: root/ChocolArm64
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-06-26 01:09:32 -0300
committergdkchan <gab.dark.100@gmail.com>2018-06-26 01:10:15 -0300
commit65105c2a3bf136202decd5ec1f5d9626d636033b (patch)
treec877fcc5656aaeabfadd12f5cc8c5da5e72deb42 /ChocolArm64
parentc81809352865a9d3be4f9ce20beea4ae39373934 (diff)
Implement SvcGetThreadContext3
Diffstat (limited to 'ChocolArm64')
-rw-r--r--ChocolArm64/Events/AInstExceptionEventArgs.cs8
-rw-r--r--ChocolArm64/Instruction/AInstEmitException.cs1
-rw-r--r--ChocolArm64/State/AThreadState.cs19
3 files changed, 21 insertions, 7 deletions
diff --git a/ChocolArm64/Events/AInstExceptionEventArgs.cs b/ChocolArm64/Events/AInstExceptionEventArgs.cs
index 34f90c8e..a6853ea1 100644
--- a/ChocolArm64/Events/AInstExceptionEventArgs.cs
+++ b/ChocolArm64/Events/AInstExceptionEventArgs.cs
@@ -4,11 +4,13 @@ namespace ChocolArm64.Events
{
public class AInstExceptionEventArgs : EventArgs
{
- public int Id { get; private set; }
+ public long Position { get; private set; }
+ public int Id { get; private set; }
- public AInstExceptionEventArgs(int Id)
+ public AInstExceptionEventArgs(long Position, int Id)
{
- this.Id = Id;
+ this.Position = Position;
+ this.Id = Id;
}
}
} \ No newline at end of file
diff --git a/ChocolArm64/Instruction/AInstEmitException.cs b/ChocolArm64/Instruction/AInstEmitException.cs
index 3e444c73..73d20967 100644
--- a/ChocolArm64/Instruction/AInstEmitException.cs
+++ b/ChocolArm64/Instruction/AInstEmitException.cs
@@ -25,6 +25,7 @@ namespace ChocolArm64.Instruction
Context.EmitLdarg(ATranslatedSub.StateArgIdx);
+ Context.EmitLdc_I8(Op.Position);
Context.EmitLdc_I4(Op.Id);
Context.EmitPrivateCall(typeof(AThreadState), MthdName);
diff --git a/ChocolArm64/State/AThreadState.cs b/ChocolArm64/State/AThreadState.cs
index a93e4cf9..a84e3242 100644
--- a/ChocolArm64/State/AThreadState.cs
+++ b/ChocolArm64/State/AThreadState.cs
@@ -51,6 +51,17 @@ namespace ChocolArm64.State
public int Fpcr { get; set; }
public int Fpsr { get; set; }
+ public int Psr
+ {
+ get
+ {
+ return (Negative ? (int)APState.N : 0) |
+ (Zero ? (int)APState.Z : 0) |
+ (Carry ? (int)APState.C : 0) |
+ (Overflow ? (int)APState.V : 0);
+ }
+ }
+
public uint CtrEl0 => 0x8444c004;
public uint DczidEl0 => 0x00000004;
@@ -89,14 +100,14 @@ namespace ChocolArm64.State
TickCounter.Start();
}
- internal void OnBreak(int Imm)
+ internal void OnBreak(long Position, int Imm)
{
- Break?.Invoke(this, new AInstExceptionEventArgs(Imm));
+ Break?.Invoke(this, new AInstExceptionEventArgs(Position, Imm));
}
- internal void OnSvcCall(int Imm)
+ internal void OnSvcCall(long Position, int Imm)
{
- SvcCall?.Invoke(this, new AInstExceptionEventArgs(Imm));
+ SvcCall?.Invoke(this, new AInstExceptionEventArgs(Position, Imm));
}
internal void OnUndefined(long Position, int RawOpCode)