Re: [PATCH] Runtime memory barrier patching

Jamie Lokier (jamie@shareable.org)
Tue, 22 Apr 2003 01:04:40 +0100


Chuck Ebbert wrote:
> > Does anybody have the preferred Intel sequence somewhere?
>
> These are in Intel ASM form (i.e. dest first) from the 486 manual:
>
> 2-bytes mov reg,reg
> 3-bytes lea reg, 0[reg] ; 8-bit displacement

Look in the GAS source code for opcodes.

At least on the 486 and Pentium (I remember that part of GAS in those
days), it makes sense to select a register that is not set in the
preceding few instructions or used in the subsequent few. Otherwise,
lea's use of a register adds an address generation delay (worse than
just a mov).

Hence use of %esi and %edi in GAS - registers allocated last by the
compiler, so least likely to be used/set in surrounding instructions.

The register selection is probably too difficult to automate, though.

-- Jamie

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