What happens when you use a memory override prefix

2020-04-11 04:17发布

问题:

What happens when you use a memory override prefix but all the operands are registers?

So, let's say you code mov eax, ebx or add eax, ebxand the default is 32-bit but you use a 67h override.

How does the processor handle that situation?

回答1:

The Intel Software Developer's Manual*, volume 2, section 2.1, details the behavior of each instruction prefix. It says use of the address-size prefix (67h) with an instruction that doesn't have a memory operand is reserved and may cause unpredictable behavior.

The operand-size prefix (66h) may be used to switch between 16- and 32-bit operand sizes and also as a mandatory prefix with certain SSE2/SSE3/SSSE3/SSE4 instructions. Other use is reserved and may cause unpredictable behavior.

The segment override prefixes are reserved with any branch instruction.

* https://software.intel.com/en-us/articles/intel-sdm