Mail Archives: djgpp/1997/05/11/16:40:26
Dave McNeill wrote:
>
> I noticed something strange today while examining
> compiler output. gcc had emitted '.align 2,0x90'
> to insert NOP's into the compiled code. When I
> took a disassembly of the resulting .EXE, gas had
> assembled the above as 'lea esi,[esi]' (8dh, 36h).
>
> Why?
It's a 2 byte nop. gas does this in the text section to minimise the
number of nop instructions (one 2 byte nop is faster than 2 one byte
nops). When browsing the gas source, I saw a table of these that went
all the way up to 16 bytes (I think). I beleive each 'nop' is carefully
chosen to be both a nop and have the minimum clock cycles.
BTW 0x90 is realy xchg ax,ax (or al,al, not sure), there's a whole slew
of (obviously) undocumented nops.
Bill
--
Leave others their otherness.
- Raw text -