aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/A32/fuzz_arm.cpp
diff options
context:
space:
mode:
authorMerryMage <[email protected]>2021-02-06 22:15:02 +0000
committerMerryMage <[email protected]>2021-02-06 22:15:02 +0000
commitb252636dc38ced4288cbabbea4ff675f69e393db (patch)
tree4f2416894c6746181fc76b3530b3d92708d40288 /tests/A32/fuzz_arm.cpp
parent331a02e02e50994063b37b37b2a9c8533d6fc6bb (diff)
downloaddynarmic-b252636dc38ced4288cbabbea4ff675f69e393db.tar.gz
dynarmic-b252636dc38ced4288cbabbea4ff675f69e393db.zip
a32_unicorn: Halt when PC leaves code_mem
Diffstat (limited to 'tests/A32/fuzz_arm.cpp')
-rw-r--r--tests/A32/fuzz_arm.cpp17
1 files changed, 3 insertions, 14 deletions
diff --git a/tests/A32/fuzz_arm.cpp b/tests/A32/fuzz_arm.cpp
index 2cd9b47e..41b37733 100644
--- a/tests/A32/fuzz_arm.cpp
+++ b/tests/A32/fuzz_arm.cpp
@@ -215,6 +215,8 @@ static void RunTestInstance(Dynarmic::A32::Jit& jit,
jit_env.code_mem.resize(code_mem_size);
uni_env.code_mem.resize(code_mem_size);
+ std::fill(jit_env.code_mem.begin(), jit_env.code_mem.end(), TestEnv::infinite_loop);
+ std::fill(uni_env.code_mem.begin(), uni_env.code_mem.end(), TestEnv::infinite_loop);
std::copy(instructions.begin(), instructions.end(), jit_env.code_mem.begin() + num_words);
std::copy(instructions.begin(), instructions.end(), uni_env.code_mem.begin() + num_words);
@@ -240,20 +242,7 @@ static void RunTestInstance(Dynarmic::A32::Jit& jit,
jit_env.ticks_left = ticks_left;
jit.Run();
- uni_env.ticks_left = [&]{
- if constexpr (std::is_same_v<TestEnv, ThumbTestEnv>) {
- // Unicorn counts thumb instructions weirdly:
- // A 32-bit thumb instruction counts as two.
- // Except for branch instructions which count as one???
- if (instructions.size() <= 1)
- return ticks_left;
- if ((instructions[instructions.size() - 2] & 0xF800) <= 0xE800)
- return instructions.size();
- return instructions.size() - 1;
- } else {
- return ticks_left;
- }
- }();
+ uni_env.ticks_left = instructions.size(); // Unicorn counts thumb instructions weirdly.
uni.Run();
SCOPE_FAIL {