Skip to contentSkip to conversation

Runtime memory barrier patching

PATCH Chuck Ebbert 2 participants 2 messages Apr 21, 2003

lore
Share & tools
lore
#0 lore raw
Quoted 1 line · Linus Torvalds

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

No opcodes handy, though...

------
Chuck

#1 lore raw
Quoted 6 lines · Chuck Ebbert
Quoted 1 line

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