Closed NaC-L closed 9 months ago
No, it should be as it is.
48 C7 00 20 00 00 00
: : : :..IMM
: : :..MODRM
: :..OPCODE
:..REX
For immediate operands size
refers to physical size of the operand which is at most 32 bits. In this case encoding is SIMM16_32_32
which is 32 bits in 64-bit mode with sign extension.
Thanks for explanation, is there a way to detect if the operand is in 64-bit mode?
mov dword ptr [rax], 0x20 and mov word ptr [rax], 0x20 also appears to has ZYDIS_OPERAND_ENCODING_SIMM16_32_32 encoding
however mov byte ptr [rax], 0x20 has ZYDIS_OPERAND_ENCODING_SIMM8
There are around 30 different variants of mov
. Also many other instructions from base ISA have specialized variants for 8-bit immediates.
I don't know what problem you're trying to solve but if you are interested in size of value that gets read/written by a memory operand you should rely on size
field for that memory operand. size
of immediates is usable only when you need low-level information about physical size of the value before any zero/sign extensions.
output:
it should've been
like the rest of the other cases with dword, word and byte.