x86 prefixes and escape opcodes flowchart

soc.me

75 points by gaul 11 hours ago


jxors - 3 hours ago

This flowchart hides the most awful parts (IMO) of x86 prefixes: some combinations of prefixes are invalid but still parsed and executed, like combining two segment overrides, or placing a legacy prefix after a REX prefix.

The CPU also doesn't care if you use prefixes that aren't valid for a specific instruction, for example a REP on a non-repeatable instruction. The LOCK prefix is the only prefix that makes the sane choice to reject invalid combinations, rather than silently accept them.

Also, the (E)VEX prefix doesn't behave like the other prefixes: it must be placed last, and can therefore only appear once. All other prefixes can be repeated.

debugnik - 9 hours ago

This site redirects to HN when it notices HN in the referrer.

st_goliath - 5 hours ago

Fun little tidbit: The 0x40-0x4f range used for the REX prefix actually clashes with the single-byte encodings for increment/decrement.

When AMD designed the 64 bit extension, they had run out of available single-byte opcodes to use as a prefix and decided to re-use those. The INC/DEC instructions are still available in 64 bit mode, but not in their single-byte encodings.

adrian_b - 5 hours ago

On that page, there is a link to another interesting page on the same site:

https://soc.me/interfaces/intels-original-64bit-extensions-f...

where there are links to a couple of patents filed by Intel in 2000, about a 64-bit extension of the x86 ISA, which had been implemented in Pentium 4, but which had been nonetheless disabled and hidden from the users, in order to not compete with Itanium.

The page explains the content of the patents.

As already mentioned by another poster, at least on Firefox you have to open a tab and then copy this link there, to avoid being identified as an "undesirable" :-)

dagenix - 8 hours ago

https://archive.ph/ZMsnQ

dataflow - an hour ago

There's EVEX2 now. It's hard to keep up...

tucnak - 7 hours ago

I respect the disobedience.

snvzz - 7 hours ago

This is in no small part why x86 code density is awful despite variable size encoding.