Why was nop
assigned to 0x90
on intel x86 assembly?
Intuitively I would expect that 0x00
would map to nop
(which is also xchg eax, eax
at intel x86) as it is the case for ARM A32
and some other architectures.
What Does No Operation (NOP) Mean? A no operation or “no-op” instruction in an assembly language is an instruction that does not implement any operation. IT pros or others might refer to this as a blank instruction or placeholder.
A NOP is most commonly used for timing purposes, to force memory alignment, to prevent hazards, to occupy a branch delay slot, to render void an existing instruction such as a jump, as a target of an execute instruction, or as a place-holder to be replaced by active instructions later on in program development (or to ...
x86 assembly language is the name for the family of assembly languages which provide some level of backward compatibility with CPUs back to the Intel 8008 microprocessor, which was launched in April 1972. It is used to produce object code for the x86 class of processors.
The x86 instruction set refers to the set of instructions that x86-compatible microprocessors support. The instructions are usually part of an executable program, often stored as a computer file and executed on the processor.
0x00000000 is not actually NOP on ARM A32 though it behaves like one; it's actually andeq r0, r0, r0
whereas a real NOP is 0xe1a00000
(mov r0, r0). It's a rather bad idea to have the NUL byte be a NOP because that makes every empty memory region a free NOP slide, greatly increasing the risk for attacks. Modern architectures generally try to make all zeroes be a break instruction or similar to avoid this attack vector. For example, ARM A64 makes 0x00000000
a permanently undefined instruction udf 0
.
0x90
is actually just one instruction of the 0x90 + r
opcode family which stands for xchg r32, eax
. eax
is register 0, so 0x90
stands for xchg eax, eax
which is a NOP. In long mode, 0x90
is special cased not to zero out the high 32 bit of rax
to keep its function as a single byte NOP.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With