as: i386-Prefixes

1 
1 9.15.6 Instruction Prefixes
1 ---------------------------
1 
1 Instruction prefixes are used to modify the following instruction.  They
1 are used to repeat string instructions, to provide section overrides, to
1 perform bus lock operations, and to change operand and address sizes.
1 (Most instructions that normally operate on 32-bit operands will use
1 16-bit operands if the instruction has an "operand size" prefix.)
1 Instruction prefixes are best written on the same line as the
1 instruction they act upon.  For example, the 'scas' (scan string)
1 instruction is repeated with:
1 
1              repne scas %es:(%edi),%al
1 
1    You may also place prefixes on the lines immediately preceding the
1 instruction, but this circumvents checks that 'as' does with prefixes,
1 and will not work with all prefixes.
1 
1    Here is a list of instruction prefixes:
1 
1    * Section override prefixes 'cs', 'ds', 'ss', 'es', 'fs', 'gs'.
1      These are automatically added by specifying using the
1      SECTION:MEMORY-OPERAND form for memory references.
1 
1    * Operand/Address size prefixes 'data16' and 'addr16' change 32-bit
1      operands/addresses into 16-bit operands/addresses, while 'data32'
1      and 'addr32' change 16-bit ones (in a '.code16' section) into
1      32-bit operands/addresses.  These prefixes _must_ appear on the
1      same line of code as the instruction they modify.  For example, in
1      a 16-bit '.code16' section, you might write:
1 
1                   addr32 jmpl *(%ebx)
1 
1    * The bus lock prefix 'lock' inhibits interrupts during execution of
1      the instruction it precedes.  (This is only valid with certain
1      instructions; see a 80386 manual for details).
1 
1    * The wait for coprocessor prefix 'wait' waits for the coprocessor to
1      complete the current instruction.  This should never be needed for
1      the 80386/80387 combination.
1 
1    * The 'rep', 'repe', and 'repne' prefixes are added to string
1      instructions to make them repeat '%ecx' times ('%cx' times if the
1      current address size is 16-bits).
1    * The 'rex' family of prefixes is used by x86-64 to encode extensions
1      to i386 instruction set.  The 'rex' prefix has four bits -- an
1      operand size overwrite ('64') used to change operand size from
1      32-bit to 64-bit and X, Y and Z extensions bits used to extend the
1      register set.
1 
1      You may write the 'rex' prefixes directly.  The 'rex64xyz'
1      instruction emits 'rex' prefix with all the bits set.  By omitting
1      the '64', 'x', 'y' or 'z' you may write other prefixes as well.
1      Normally, there is no need to write the prefixes explicitly, since
1      gas will automatically generate them based on the instruction
1      operands.
1