From a8b938ef32403735441e8c0cae2ddadf61afdb7d Mon Sep 17 00:00:00 2001 From: MerryMage Date: Wed, 1 Aug 2018 15:30:43 +0100 Subject: [PATCH] fuzz_with_unicorn: Randomize SP --- tests/A64/fuzz_with_unicorn.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/A64/fuzz_with_unicorn.cpp b/tests/A64/fuzz_with_unicorn.cpp index cc13cf7e..1b3db9b0 100644 --- a/tests/A64/fuzz_with_unicorn.cpp +++ b/tests/A64/fuzz_with_unicorn.cpp @@ -182,10 +182,12 @@ static void RunTestInstance(const Unicorn::RegisterArray& regs, const Unicorn::V static Dynarmic::A64::Jit jit{jit_user_config}; static Unicorn uni{uni_env}; + const u64 initial_sp = RandInt(0x30'0000'0000, 0x40'0000'0000) * 4; + jit.SetRegisters(regs); jit.SetVectors(vecs); jit.SetPC(instructions_start); - jit.SetSP(0x08000000); + jit.SetSP(initial_sp); jit.SetFpcr(fpcr); jit.SetFpsr(0); jit.SetPstate(pstate); @@ -193,7 +195,7 @@ static void RunTestInstance(const Unicorn::RegisterArray& regs, const Unicorn::V uni.SetRegisters(regs); uni.SetVectors(vecs); uni.SetPC(instructions_start); - uni.SetSP(0x08000000); + uni.SetSP(initial_sp); uni.SetFpcr(fpcr); uni.SetFpsr(0); uni.SetPstate(pstate); @@ -216,7 +218,7 @@ static void RunTestInstance(const Unicorn::RegisterArray& regs, const Unicorn::V fmt::print("{:3s}: {:016x}\n", static_cast(i), regs[i]); for (size_t i = 0; i < vecs.size(); ++i) fmt::print("{:3s}: {}\n", static_cast(i), vecs[i]); - fmt::print("sp : 08000000\n"); + fmt::print("sp : {:016x}\n", initial_sp); fmt::print("pc : {:016x}\n", instructions_start); fmt::print("p : {:08x}\n", pstate); fmt::print("fpcr {:08x}\n", fpcr);