aboutsummaryrefslogtreecommitdiff
path: root/ChocolArm64/State
diff options
context:
space:
mode:
Diffstat (limited to 'ChocolArm64/State')
-rw-r--r--ChocolArm64/State/APState.cs4
-rw-r--r--ChocolArm64/State/ARoundMode.cs4
-rw-r--r--ChocolArm64/State/AThreadState.cs17
-rw-r--r--ChocolArm64/State/FPCR.cs11
-rw-r--r--ChocolArm64/State/FPExc.cs12
-rw-r--r--ChocolArm64/State/FPSR.cs8
-rw-r--r--ChocolArm64/State/FPType.cs11
7 files changed, 62 insertions, 5 deletions
diff --git a/ChocolArm64/State/APState.cs b/ChocolArm64/State/APState.cs
index f55431a6..aaf0ff0c 100644
--- a/ChocolArm64/State/APState.cs
+++ b/ChocolArm64/State/APState.cs
@@ -3,7 +3,7 @@ using System;
namespace ChocolArm64.State
{
[Flags]
- public enum APState
+ enum APState
{
VBit = 28,
CBit = 29,
@@ -20,4 +20,4 @@ namespace ChocolArm64.State
NZCV = NZ | CV
}
-} \ No newline at end of file
+}
diff --git a/ChocolArm64/State/ARoundMode.cs b/ChocolArm64/State/ARoundMode.cs
index 9896f307..297d0137 100644
--- a/ChocolArm64/State/ARoundMode.cs
+++ b/ChocolArm64/State/ARoundMode.cs
@@ -1,10 +1,10 @@
namespace ChocolArm64.State
{
- public enum ARoundMode
+ enum ARoundMode
{
ToNearest = 0,
TowardsPlusInfinity = 1,
TowardsMinusInfinity = 2,
TowardsZero = 3
}
-} \ No newline at end of file
+}
diff --git a/ChocolArm64/State/AThreadState.cs b/ChocolArm64/State/AThreadState.cs
index e4953b02..fbfac5bc 100644
--- a/ChocolArm64/State/AThreadState.cs
+++ b/ChocolArm64/State/AThreadState.cs
@@ -145,5 +145,20 @@ namespace ChocolArm64.State
{
Undefined?.Invoke(this, new AInstUndefinedEventArgs(Position, RawOpCode));
}
+
+ internal bool GetFpcrFlag(FPCR Flag)
+ {
+ return (Fpcr & (1 << (int)Flag)) != 0;
+ }
+
+ internal void SetFpsrFlag(FPSR Flag)
+ {
+ Fpsr |= 1 << (int)Flag;
+ }
+
+ internal ARoundMode FPRoundingMode()
+ {
+ return (ARoundMode)((Fpcr >> (int)FPCR.RMode) & 3);
+ }
}
-} \ No newline at end of file
+}
diff --git a/ChocolArm64/State/FPCR.cs b/ChocolArm64/State/FPCR.cs
new file mode 100644
index 00000000..8f47cf90
--- /dev/null
+++ b/ChocolArm64/State/FPCR.cs
@@ -0,0 +1,11 @@
+namespace ChocolArm64.State
+{
+ enum FPCR
+ {
+ UFE = 11,
+ RMode = 22,
+ FZ = 24,
+ DN = 25,
+ AHP = 26
+ }
+}
diff --git a/ChocolArm64/State/FPExc.cs b/ChocolArm64/State/FPExc.cs
new file mode 100644
index 00000000..a665957d
--- /dev/null
+++ b/ChocolArm64/State/FPExc.cs
@@ -0,0 +1,12 @@
+namespace ChocolArm64.State
+{
+ enum FPExc
+ {
+ InvalidOp = 0,
+ DivideByZero = 1,
+ Overflow = 2,
+ Underflow = 3,
+ Inexact = 4,
+ InputDenorm = 7
+ }
+}
diff --git a/ChocolArm64/State/FPSR.cs b/ChocolArm64/State/FPSR.cs
new file mode 100644
index 00000000..d71cde78
--- /dev/null
+++ b/ChocolArm64/State/FPSR.cs
@@ -0,0 +1,8 @@
+namespace ChocolArm64.State
+{
+ enum FPSR
+ {
+ UFC = 3,
+ QC = 27
+ }
+}
diff --git a/ChocolArm64/State/FPType.cs b/ChocolArm64/State/FPType.cs
new file mode 100644
index 00000000..b00f5fee
--- /dev/null
+++ b/ChocolArm64/State/FPType.cs
@@ -0,0 +1,11 @@
+namespace ChocolArm64.State
+{
+ enum FPType
+ {
+ Nonzero,
+ Zero,
+ Infinity,
+ QNaN,
+ SNaN
+ }
+}