News for hackers. Stuff that matters.
Re:Why do Windows functions all begin with a pointless MOV E... by ajross on Wednesday September 21, 2011 @12:30PM (#3022623)
NOOP sequences in x86 are a fun subject. There's an interesting section in Intel's optimization guide somewhere (I'm too lazy to find it) that details "best practice" noop instructions of 1, 2, ... up to something like 9 bytes. These are used for alignment puposes too, where you need a few bytes of padding to make a loop-back target cache-line aligned or whatnot.
Re:Why do Windows functions all begin with a pointless MOV E... by haberman on Wednesday September 21, 2011 @05:14PM (#3023722)
Check out the "smartalign" package in NASM: it contains 1-8 byte nop instructions for several different x86 variants: http://repo.or.cz/w/nasm.git/blob/a2c78555770990ed966c414da9...

You can use xxd and objdump to see which all of these translate into. For example, here's an 8-byte nop for x86-64:

  $ echo '0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00' | xxd -r > /tmp/bincode
  $ objdump -M intel -D -b binary -mi386 -Mx86-64 /tmp/bincode
  
  /tmp/bincode:     file format binary
  
  
  Disassembly of section .data:
  
  00000000 <.data>:
     0:   0f 1f 84 00 00 00 00    nop    DWORD PTR [rax+rax*1+0x0]
     7:   00