unicorn-engine / unicorn

Unicorn CPU emulator framework (ARM, AArch64, M68K, Mips, Sparc, PowerPC, RiscV, S390x, TriCore, X86)
http://www.unicorn-engine.org
GNU General Public License v2.0
7.66k stars 1.35k forks source link

reg_read from wsp in Arm64 / Aarch64 doesn't work #2020

Open Montg0mery opened 1 month ago

Montg0mery commented 1 month ago

I don't actually need this, but when diagnosing #2019 I noticed that wsp is the only other register aside from xzr and wzr which isn't handled (apart from UC_ARM64_REG_INVALID and UC_ARM64_REG_ENDING but those are obviously intentionally invalid registers that purposefully shouldn't be implemented).

Unlike #2019, this one has never worked as far as I can tell (it always returned zero even when sp had all non-zero bytes, which unlike the other two registers, is not actually the expected value).

For completeness (in case any actual code does use this register), it might make sense to actually implement it, but I've separated this issue out from #2019 as that issue is much more important as xzr and wzr are widely used.

wtdcode commented 1 month ago

Fix in 05e29b4507c06655e815f6cc970c9f2eb98f8ead