4 ms·
As far as I can tell, "illegal" and "undocumented" instructions are the same thing[0]. Likely they are "illegal" according to the spec of the processor, and th
by Arcsech 9y ago
As far as I can tell, "illegal" and "undocumented" instructions are the same thing[0]. Likely they are "illegal" according to the spec of the processor, and that's where the term came from.
[0] At least according to Wikipedia: https://en.wikipedia.org/wiki/Illegal_opcode https://en.wikipedia.org/wiki/Illegal_opcode
- mikeash 9y agoThe paper only uses that phrase once, as a synonym for a non-existing instruction. It seems that refers to an instruction that the CPU will not execute, and which throws a #UD exception. Despite being illegal/nonexistent, these instructions still have a length, which is how many bytes the CPU decodes before it throws that exception. They can figure this out by placing an illegal instruction sequence at the end of a page, where the next page is marked as non-executable, and sliding it around. If the CPU tries to decode bytes on the next page, it throws #GP. Once you slide the instruction far enough to get a #UD instead, you know that the illegal instruction is that many bytes. This is different from undocumented instructions, which are valid instructions that the CPU can actually execute, but which don't appear in the CPU's documentation. These may be instructions which were deliberately added as part of the design but which didn't make it into the documentation for whatever reason, or they may be an unintended consequence of other aspects of the CPU's design. (The 6502 famously has a lot of undocumented opcodes of the second kind, see http://www.pagetable.com/?p=39 http://www.pagetable.com/?p=39 for more info on those.)