Re: NOP instruction

Richard B. Johnson (root@chaos.analogic.com)
Tue, 15 Dec 1998 09:02:53 -0500 (EST)


On Tue, 15 Dec 1998, Chipzz wrote:

> On Mon, 14 Dec 1998, Riley Williams wrote:
>
> > From: Riley Williams <rhw@bigfoot.com>
> > Subject: Re: [PATCH] i386 entry.S alignment tweak
[SNIP]
>
> I've always wondered... A much used NOP "instruction" is
> OR AX,AX (or similar);
> But doesn't this, as well as MOV DI,DI, set the zero flag???
> As a NOP instruction is supposed to do nothing, would this then be wrong?
> (Nothing meaning not setting any flags?)
>
> Hmmm... Where's the time from the good ol' Z80 when you HAD a real NOP
> instruction? *Sigh* :-)

A mov (move) does not set any flags. The Intel NOP is 0x90. It is
really xchg eax, eax which means to swap the contents of eax and eax,
in fact doing nothing.

The problem is that it's a single byte instruction. If you have nicely
aligned instructions, obtaining data on longword aligned addresses,
fetching instructions on longword aligned addresses, the machine is
very happy and cache-line refills are transparent. However, if you
throw in a bye-size opcode, instruction fetches are no longer aligned
so the machine slows down. The trick is to find an instruction sequence
that does nothing, but maintains 4 byte alignment.

Cheers,
Dick Johnson
***** FILE SYSTEM WAS MODIFIED *****
Penguin : Linux version 2.1.131 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/