I have gotten an interesting thing from the instruction encoding of NASM.
NEG byte [0x10000000], NEG word [0x10000000], whatever. This instruction is encoded differently in the 32-bit and 64-bit mode.
Actually, there is no form for the 64-bit addressing in displacement or immediate (Must be referenced by the 64-bit register addressing).
NEG byte [0x10000000] is encoded as
32: 0xF6 0x1D 0x00 0x00 0x00 0x10
64: 0xF6 0x1C 0x25 0x00 0x00 0x00 0x10
Both of them are valid in the 32-bit mode. And, I think that the code that NASM encoded in the 64-bit mode is not effecient.
NASM added an unnecessary SIB byte.
- Is there any reasons that NASM did so?
- Is 0xF6 0x1D 0x00 0x00 0x00 0x10 invalid in 64-bit systems?
Unfortunately, I do not currently have any 64-bit machines. So, I could not test it.
Thank you for reading my question.
Sorry, I have gotten an answer after I read the manual again.
0xF6 0x1D ADDR was a RIP-relative addressing form.