Files
Mohammed Abuhassan 83f5638107 refactor(verify): extract emulate_block into a reusable public API
The Unicorn-backed block emulator was previously locked inside an
anonymous namespace in unicorn_verify.cpp, only reachable through the
patch-pair walker. The rule-pack expansion work needs to drive the
same emulator with hand-rolled byte buffers and arbitrary initial
states, so move the implementation into a dedicated header/source
pair and expose:

  morphkatz::verify::BlockEmuState        // GPRs + RFLAGS in/out
  morphkatz::verify::BlockEmuResult       // ok + out state + error
  morphkatz::verify::default_block_emu_state()
  morphkatz::verify::emulate_block(code, va, in, timeout_ms)

`unicorn_verify` now consumes the same public API instead of holding
a private copy. No behavioural change: the per-block sandbox layout
(stack page, code page, GPR seeding, RFLAGS seeding, timeout) is
preserved byte-for-byte, and unicorn_verify still uses
default_block_emu_state() as its single seed.

Wiring: * CMakeLists.txt adds src/verify/block_emu.cpp to morphkatz_core.
  * Same change ships a long-standing ASan/Catch2 mismatch fix:
    vcpkg's Catch2 is built without container annotations, so
    /fsanitize=address objects refused to link. Setting
    _DISABLE_STRING_ANNOTATION + _DISABLE_VECTOR_ANNOTATION on the
    ASan path keeps both vs2022-x64-asan and clang-cl-asan green.
2026-06-06 13:52:19 +03:00
..