Blackbone
Blackbone copied to clipboard
Missing support for 64-bit movabs in bundled AsmJit
The bundled version of AsmJit doesn't seem to support 64-bit absolute mov (e.g. mov [0x0123456789abcdef], rax
). Using the following code (not using AsmFactory::GetAssembler() to make sure it's not a bug in BlackBone itself, but the same happens using AsmFactory as well):
asmjit::JitRuntime rt;
asmjit::X86Assembler a(&rt, asmjit::kArchX64);
a.mov(asmjit::x86::qword_ptr_abs(0x0123456789abcdefull), asmjit::x86::rax);
LogInfo("Code (%u bytes): %s", (unsigned int) a.getCodeSize(), FormatByteArray(ByteArray((uint8_t*) a.make(), a.getCodeSize())).get());
The bundled version of AsmJit generates:
48 89 04 25 EF CD AB 89
which cuts off half of the address. It doesn't seem to handle the special 64-bit movabs correctly. I've tried adding a.rex() or a.long_(), but nothing changed. The latest version of AsmJit generates:
48 A3 EF CD AB 89 67 45 23 01
Which is the expected instruction.
So until the AsmJit in BlackBone is updated, I think I'll have to generate the instruction bytes manually.
I also think this is because asmjit is too old. Same as "https://github.com/DarthTon/Blackbone/issues/380". The new version of asmjit can fix the problem.