Saturday, 27 August 2011

CPU Chill Out Zone: For what XCHG EAX, EAX?

No-op, NOP or NOOP is an instruction that tells the processor to "take a breather", "chill out", "do nothing". In Intel instructions language, this translates to:

XCHG EAX, EAX

But, dude, I though meditation was just for humans, not machines? What's the deal? Why do we have a programming instruction that says, computer, do nowt?

Here we attempt to list as many applications of NOOP as possible.

1. Forcing memory alignment
2. Occupying a branch delay slot
3. To support replacing LOCs with NOOPs to deactivate undesired functionalities

No comments:

Post a Comment