You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[emulator] Fix test cases that asserted on IL the API cannot express
Several per-instruction tests were themselves wrong, and only became visible
once the suite stopped segfaulting on its first test.
LLIL constants carry a 64-bit value, so il.const(16, 1 << 64) and
il.const(16, -17) silently truncated: the first made SET_REG_SPLIT's source 2
rather than 2**64 + 2, and the second turned the DIVS_DP/MODS_DP dividend into a
large positive 128-bit value, testing unsigned division under a signed name.
Build those operands with a shift and a sign-extend instead.
The ADC/SBB carry, SET_FLAG and IF conditions used il.const(0, 1) -- a zero-byte
constant, which correctly masks to 0, so the tests asserted carry-in of 1 while
passing 0. Real lifted IL uses a flag expression here (adc.q(rax, rbx, flag:c)),
never a zero-size constant; use a 1-byte constant.
test_load seeded memory with (0xefbeadde).to_bytes(4, 'little') and expected a
little-endian load to return 0xdeadbeef, which is the byte-reversed value.
The intrinsic hook took four parameters, but the documented and implemented
contract is (emulator, intrinsic_id, params) returning a list of (register,
value) pairs. The resulting TypeError was swallowed by the binding's bare except
and surfaced only as an Unimplemented stop.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments