130
Chapter 21. 80386 Dependent Features
The bus lock prefix
lock
inhibits interrupts during execution of the instruction it precedes. (This is
only valid with certain instructions; see a 80386 manual for details).
The wait for coprocessor prefix
wait
waits for the coprocessor to complete the current instruction.
This should never be needed for the 80386/80387 combination.
The
rep
,
repe
, and
repne
prefixes are added to string instructions to make them repeat
%ecx
times (
%cx
times if the current address size is 16 bits).
The
rex
family of prefixes is used by x86 64 to encode extensions to i386 instruction set. The
rex
prefix has four bits an operand size overwrite (
64
) used to change operand size from 32 bit to
64 bit and X, Y and Z extensions bits used to extend the register set.
You may write the
rex
prefixes directly. The
rex64xyz
instruction emits
rex
prefix with all the
bits set. By omitting the
64
,
x
,
y
or
z
you may write other prefixes as well. Normally, there is
no need to write the prefixes explicitly, since gas will automatically generate them based on the
instruction operands.
21.6. Memory References
An Intel syntax indirect memory reference of the form
section:[base + index*scale + disp]
is translated into the AT&T syntax
section:disp(base, index, scale)
where
base
and
index
are the optional 32 bit base and index registers,
disp
is the optional displace
ment, and
scale
, taking the values 1, 2, 4, and 8, multiplies
index
to calculate the address of the
operand. If no
scale
is specified,
scale
is taken to be 1.
section
specifies the optional section
register for the memory operand, and may override the default section register (see a 80386 manual
for section register defaults). Note that section overrides in AT&T syntax must be preceded by a
%
. If
you specify a section override which coincides with the default section register,
as
does not output
any section register override prefixes to assemble the given instruction. Thus, section overrides can be
specified to emphasize which section register is used for a given memory operand.
Here are some examples of Intel and AT&T style memory references:
AT&T:
4(%ebp)
, Intel:
[ebp 4]
base
is
%ebp
;
disp
is
4
.
section
is missing, and the default section is used (
%ss
for address
ing with
%ebp
as the base register).
index
,
scale
are both missing.
AT&T:
foo(,%eax,4)
, Intel:
[foo + eax*4]
index
is
%eax
(scaled by a
scale
4);
disp
is
foo
. All other fields are missing. The section
register here defaults to
%ds
.
AT&T:
foo(,1)
; Intel
[foo]
This uses the value pointed to by
foo
as a memory operand. Note that
base
and
index
are both
missing, but there is only one
,
. This is a syntactic exception.
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved