128
Chapter 21. 80386 Dependent Features
Immediate form long jumps and calls are
lcall/ljmp $section, $offset
in AT&T syntax;
the Intel syntax is
call/jmp far section:offset
. Also, the far return instruction is
lret
$stack adjust
in AT&T syntax; Intel syntax is
ret far stack adjust
.
The AT&T assembler does not provide support for multiple section programs. Unix style systems
expect all programs to be single sections.
21.3. Instruction Naming
Instruction mnemonics are suffixed with one character modifiers which specify the size of operands.
The letters
b
,
w
,
l
and
q
specify byte, word, long and quadruple word operands. If no suffix is specified
by an instruction then
as
tries to fill in the missing suffix based on the destination register operand
(the last one by convention). Thus,
mov %ax, %bx
is equivalent to
movw %ax, %bx
; also,
mov $1,
%bx
is equivalent to
movw $1, bx
. Note that this is incompatible with the AT&T Unix assembler
which assumes that a missing mnemonic suffix implies long operand size. (This incompatibility does
not affect compiler output since compilers always explicitly specify the mnemonic suffix.)
Almost all instructions have the same names in AT&T and Intel format. There are a few exceptions.
The sign extend and zero extend instructions need two sizes to specify them. They need a size to
sign/zero extend from and a size to zero extend to. This is accomplished by using two instruction
mnemonic suffixes in AT&T syntax. Base names for sign extend and zero extend are
movs...
and
movz...
in AT&T syntax (
movsx
and
movzx
in Intel syntax). The instruction mnemonic suffixes are
tacked on to this base name, the from suffix before the to suffix. Thus,
movsbl %al, %edx
is AT&T
syntax for "move sign extend from %al to %edx." Possible suffixes, thus, are
bl
(from byte to long),
bw
(from byte to word),
wl
(from word to long),
bq
(from byte to quadruple word),
wq
(from word to
quadruple word), and
lq
(from long to quadruple word).
The Intel syntax conversion instructions
cbw
sign extend byte in
%al
to word in
%ax
,
cwde
sign extend word in
%ax
to long in
%eax
,
cwd
sign extend word in
%ax
to long in
%dx:%ax
,
cdq
sign extend dword in
%eax
to quad in
%edx:%eax
,
cdqe
sign extend dword in
%eax
to quad in
%rax
(x86 64 only),
cdo
sign extend quad in
%rax
to octuple in
%rdx:%rax
(x86 64 only),
are called
cbtw
,
cwtl
,
cwtd
,
cltd
,
cltq
, and
cqto
in AT&T naming.
as
accepts either naming for
these instructions.
Far call/jump instructions are
lcall
and
ljmp
in AT&T syntax, but are
call far
and
jump far
in
Intel convention.
21.4. Register Naming
Register operands are always prefixed with
%
. The 80386 registers consist of
the 8 32 bit registers
%eax
(the accumulator),
%ebx
,
%ecx
,
%edx
,
%edi
,
%esi
,
%ebp
(the frame
pointer), and
%esp
(the stack pointer).
the 8 16 bit low ends of these:
%ax
,
%bx
,
%cx
,
%dx
,
%di
,
%si
,
%bp
, and
%sp
.
the 8 8 bit registers:
%ah
,
%al
,
%bh
,
%bl
,
%ch
,
%cl
,
%dh
, and
%dl
(These are the high bytes and
low bytes of
%ax
,
%bx
,
%cx
, and
%dx
)
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