aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Tests.Unicorn/UnicornAArch32.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Tests.Unicorn/UnicornAArch32.cs')
-rw-r--r--Ryujinx.Tests.Unicorn/UnicornAArch32.cs14
1 files changed, 12 insertions, 2 deletions
diff --git a/Ryujinx.Tests.Unicorn/UnicornAArch32.cs b/Ryujinx.Tests.Unicorn/UnicornAArch32.cs
index 45d2da7a..e1efb52f 100644
--- a/Ryujinx.Tests.Unicorn/UnicornAArch32.cs
+++ b/Ryujinx.Tests.Unicorn/UnicornAArch32.cs
@@ -41,8 +41,8 @@ namespace Ryujinx.Tests.Unicorn
public uint PC
{
- get => GetRegister(Arm32Register.PC);
- set => SetRegister(Arm32Register.PC, value);
+ get => GetRegister(Arm32Register.PC) & 0xfffffffeu;
+ set => SetRegister(Arm32Register.PC, (value & 0xfffffffeu) | (ThumbFlag ? 1u : 0u));
}
public uint CPSR
@@ -87,6 +87,16 @@ namespace Ryujinx.Tests.Unicorn
set => CPSR = (CPSR & ~0x80000000u) | (value ? 0x80000000u : 0u);
}
+ public bool ThumbFlag
+ {
+ get => (CPSR & 0x00000020u) != 0;
+ set
+ {
+ CPSR = (CPSR & ~0x00000020u) | (value ? 0x00000020u : 0u);
+ SetRegister(Arm32Register.PC, (GetRegister(Arm32Register.PC) & 0xfffffffeu) | (value ? 1u : 0u));
+ }
+ }
+
public UnicornAArch32()
{
Interface.Checked(Interface.uc_open(UnicornArch.UC_ARCH_ARM, UnicornMode.UC_MODE_LITTLE_ENDIAN, out uc));