NOP

From Asmpedia

Jump to: navigation, search

No operation

Intel AMD
+ +


Definition:

NOP

One-byte or two-byte (with 0x66 prefix) instruction is equivalent to XCHG (E)AX, E(AX)
Multi-byte (>=3 bytes) NOP is supported on processors with CPUID[0x01][EAX:8:11] == 0110 || 1111


Operation in pseudo code:

nop()
{
  if (opcode==0x0F1F && processor doesn't support multi-byte NOP)
  {
     throw #UD; // invalid opcode exception 
  }
}


Opcodes (x86/x64):

90 - NOP -
0F 1F mod (xx) reg (xxx) r/m (xxx) NOP r/m16/32 -


EFLAGS


:31

:30

:29

:28

:27

:26

:25

:24

:23

:22
ID
:21
VIP
:20
VIF
:19
AC
:18
VM
:17
RF
:16

:15
NT
:14
IOPL
:13:12
OF
:11
DF
:10
IF
:9
TF
:8
SF
:7
ZF
:6

:5
AF
:4

:3
PF
:2

:1
CF
:0
0000000000------0--------0-0-1-


Annotated WinDbg disassembly (x86/x64):

90              nop
6690            xchg    ax,ax ; 66: switch to 16-bit operand 90: opcode 
0f1f00          nop     dword ptr [eax] ; 0f1f: 2-byte opcode 00: mod=00 reg=000 rm=000 [EAX]
0f1f4000        nop     dword ptr [eax] ; 0f1f: 2-byte opcode 40: mod=01 reg=000 rm=000 [EAX+0x00]
0f1f440000      nop     dword ptr [eax+eax] ; 0f1f: 2-byte opcode 44: mod=01 reg=000 rm=100 SIB + 0x00
660f1f440000    nop     word ptr [eax+eax] ; 66: switch to 16-bit operand 0f1f: 2-byte opcode 44: mod=01 reg=000 rm=100 SIB + 0x00
0f1f8000000000  nop     dword ptr [eax] ; 0f1f: 2-byte opcode 80: mod=10 reg=000 rm=000 [EAX+0x00000000]
Personal tools