3 ms·
> There are only a few cases where you really need to manually include size information; off the top of my head, I can only think of: sign- or zero-extended mov
by amluto 4y ago
> There are only a few cases where you really need to manually include size information; off the top of my head, I can only think of: sign- or zero-extended moves out of memory, and operations involving a memory and immediate operand.
There are a whole bunch of instructions with no operands at all that nonetheless have sizes. The most useful that comes to mind is SYSRET. sysretl and sysretq are both useful but are not interchangeable.
- starmole 4y agonop and enop and fnop! so many nops: https://www.felixcloutier.com/x86/nop https://www.felixcloutier.com/x86/nop
- amluto 4y agoFunny you mention nop. The classic nop is 0x90, which decodes to XCHG EAX, EAX, which, on x86_32, does nothing. But x86_64 made 32-bit operations zero the high 32 bits of the destination register, so, logically, 0x90 would clear the high bits of RAX. Oops. As I’ve heard the story, this was noticed a bit on the late side, and an 11th hour change was made to special case 0x90 and make it still be a nop.
- Taniwha 4y agoThere a whole bunch of architectures where you have to specify instruction sizes - the intel prefix thing is really the odd one out - more importantly the PDP-11 (where the AT&T format came from) had ubiquitous 8 and 16-bit instructions