News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Encoding of NEG byte [0x10000000]

Started by woonsan, October 19, 2008, 06:27:20 PM

Previous topic - Next topic

woonsan

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.

woonsan

#1
Sorry, I have gotten an answer after I read the manual again.
0xF6 0x1D ADDR was a RIP-relative addressing form.