I am aware i can decode the instruction, then check the op.dtype. But this doesnt work in cases such as mov eax, dword [rax] because the second operand will be of dtype dword, while the basereg register rax is of course 64bits.

How can I find out that rax is a 64bit register in this case?

  • 1
    I don't think you can get that information directly from the insn_t/op_t representation. The sizes of the registers used in an x86/x64 memory expression are implicit; they're equal to the size of the operating mode. I.e. in 32-bit (64-bit) mode, registers in a memory expression will always be 32-bits (64-bits). It probably works similarly on most other platforms, though you may need platform-specific logic in some cases. Feb 23 at 18:33


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.