diff --git a/tests/A32/fuzz_arm.cpp b/tests/A32/fuzz_arm.cpp index 258353bf..a2654dd9 100644 --- a/tests/A32/fuzz_arm.cpp +++ b/tests/A32/fuzz_arm.cpp @@ -285,6 +285,7 @@ static void RunTestInstance(Dynarmic::A32::Jit& jit, const u32 initial_pc = regs[15]; const u32 num_words = initial_pc / sizeof(typename TestEnv::InstructionType); const u32 code_mem_size = num_words + static_cast(instructions.size()); + const u32 expected_end_pc = code_mem_size * sizeof(typename TestEnv::InstructionType); jit_env.code_mem.resize(code_mem_size); uni_env.code_mem.resize(code_mem_size); @@ -393,6 +394,14 @@ static void RunTestInstance(Dynarmic::A32::Jit& jit, uni.SetPC(new_uni_pc); } + if (uni.GetRegisters()[15] > jit.Regs()[15]) { + const u32 final_pc = jit.Regs()[15]; + if (final_pc >= initial_pc && final_pc < expected_end_pc) { + fmt::print("Warning: Possible unicorn overrrun, attempt recovery\n"); + jit.Step(); + } + } + REQUIRE(uni.GetRegisters() == jit.Regs()); REQUIRE(uni.GetExtRegs() == jit.ExtRegs()); REQUIRE((uni.GetCpsr() & 0xFFFFFDDF) == (jit.Cpsr() & 0xFFFFFDDF));