AlexAltea / unicorn.js

Unicorn CPU emulator framework port for JavaScript
https://alexaltea.github.io/unicorn.js/
GNU General Public License v2.0
566 stars 36 forks source link

Unicorn v1.0 breaks `tcg_gen_callN` again #7

Closed AlexAltea closed 7 years ago

AlexAltea commented 7 years ago

The adapter_helper_* functions are defined in qemu/include/exec/helper-gen.h, and may be included in different source files causing pointers to the same adapter to differ. In particular, tcg.c records the pointers in the s->helpers map, while the helper generation commands issued from qemu/target-* are pointing to different adapters, whose pointers are not registered in s->helpers.

This causes a null-pointer dereference which Emscripten ignores. Incorrect flags value are returned for queried functions causing the cpu_exit wrappers to be optimized away and Unicorn.js gets stuck in an endless loop.

Stick to v1.0-rc3 until I fix this. Probably earlier versions weren't affected out of sheer luck.

AlexAltea commented 7 years ago

Fixed in 0037b18e86a3ea0650c993a0cb4b4346121543ff.