From 2acfee66ed1b404636328fdec1656380aac1649d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 20 Apr 2019 05:45:45 -0400 Subject: [PATCH] a32_unicorn: Silence PC value assertions Ensure the PC is properly masked off after a run. --- tests/unicorn_emu/a32_unicorn.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/unicorn_emu/a32_unicorn.cpp b/tests/unicorn_emu/a32_unicorn.cpp index 7dd487a5..21780ba5 100644 --- a/tests/unicorn_emu/a32_unicorn.cpp +++ b/tests/unicorn_emu/a32_unicorn.cpp @@ -8,6 +8,7 @@ #include "A32/testenv.h" #include "a32_unicorn.h" #include "common/assert.h" +#include "common/bit_util.h" #define CHECKED(expr) \ do { \ @@ -41,15 +42,19 @@ A32Unicorn::~A32Unicorn() { template void A32Unicorn::Run() { // Thumb execution mode requires the LSB to be set to 1. - constexpr u64 mask = std::is_same_v ? 0 : 1; - + constexpr u64 pc_mask = std::is_same_v ? 0 : 1; while (testenv.ticks_left > 0) { - CHECKED(uc_emu_start(uc, GetPC() | mask, END_ADDRESS, 0, 1)); + CHECKED(uc_emu_start(uc, GetPC() | pc_mask, END_ADDRESS, 0, 1)); testenv.ticks_left--; if (!testenv.interrupts.empty() || testenv.code_mem_modified_by_guest) { return; } } + + const bool T = Dynarmic::Common::Bit<5>(GetCpsr()); + const u32 mask = T ? 0xFFFFFFFE : 0xFFFFFFFC; + const u32 new_pc = GetPC() & mask; + SetPC(new_pc); } template