aboutsummaryrefslogtreecommitdiff
path: root/ChocolArm64/State/CpuThreadState.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2019-01-29 13:06:11 -0300
committerGitHub <noreply@github.com>2019-01-29 13:06:11 -0300
commitc1bdf19061ec679aa3c69eda2a41337e3e809014 (patch)
treef3813b8df8ff8dd1fbf73fd085893b0df21850dc /ChocolArm64/State/CpuThreadState.cs
parent8f7fcede7fa98c605925dc7b9316940960543bf1 (diff)
Implement some ARM32 memory instructions and CMP (#565)
* Implement ARM32 memory instructions: LDM, LDR, LDRB, LDRD, LDRH, LDRSB, LDRSH, STM, STR, STRB, STRD, STRH (immediate and register + immediate variants), implement CMP (immediate and register shifted by immediate variants) * Rename some opcode classes and flag masks for consistency * Fix a few suboptimal ARM32 codegen issues, only loads should be considered on decoder when checking if Rt == PC, and only NZCV flags should be considered for comparison optimizations * Take into account Rt2 for LDRD instructions aswell when checking if the instruction changes PC * Re-align arm32 instructions on the opcode table
Diffstat (limited to 'ChocolArm64/State/CpuThreadState.cs')
-rw-r--r--ChocolArm64/State/CpuThreadState.cs19
1 files changed, 10 insertions, 9 deletions
diff --git a/ChocolArm64/State/CpuThreadState.cs b/ChocolArm64/State/CpuThreadState.cs
index 6c00bf48..12edc429 100644
--- a/ChocolArm64/State/CpuThreadState.cs
+++ b/ChocolArm64/State/CpuThreadState.cs
@@ -13,8 +13,6 @@ namespace ChocolArm64.State
private const int MinInstForCheck = 4000000;
- public bool Thumb;
-
public ulong X0, X1, X2, X3, X4, X5, X6, X7,
X8, X9, X10, X11, X12, X13, X14, X15,
X16, X17, X18, X19, X20, X21, X22, X23,
@@ -25,13 +23,16 @@ namespace ChocolArm64.State
V16, V17, V18, V19, V20, V21, V22, V23,
V24, V25, V26, V27, V28, V29, V30, V31;
+ public bool Aarch32;
+
+ public bool Thumb;
+ public bool BigEndian;
+
public bool Overflow;
public bool Carry;
public bool Zero;
public bool Negative;
- public bool IsAarch32;
-
public int ElrHyp;
public bool Running { get; set; }
@@ -51,10 +52,10 @@ namespace ChocolArm64.State
{
get
{
- return (Negative ? (int)PState.N : 0) |
- (Zero ? (int)PState.Z : 0) |
- (Carry ? (int)PState.C : 0) |
- (Overflow ? (int)PState.V : 0);
+ return (Negative ? (int)PState.NMask : 0) |
+ (Zero ? (int)PState.ZMask : 0) |
+ (Carry ? (int)PState.CMask : 0) |
+ (Overflow ? (int)PState.VMask : 0);
}
}
@@ -140,7 +141,7 @@ namespace ChocolArm64.State
internal ExecutionMode GetExecutionMode()
{
- if (!IsAarch32)
+ if (!Aarch32)
{
return ExecutionMode.Aarch64;
}