2011-08-27 16:28:25 -07:00
'\" t
2006-10-21 08:07:09 +00:00
. \" Title: yasm_arch
. \" Author: Peter Johnson <peter@tortall.net>
2012-08-30 23:53:29 -07:00
. \" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
2006-10-21 08:07:09 +00:00
. \" Date: October 2006
2006-10-21 18:52:29 +00:00
. \" Manual: Yasm Supported Architectures
. \" Source: Yasm
2011-08-27 16:28:25 -07:00
. \" Language: English
2006-10-21 08:07:09 +00:00
. \"
2006-10-21 18:52:29 +00:00
.TH "YASM_ARCH" "7" "October 2006" "Yasm" "Yasm Supported Architectures"
2011-08-27 16:28:25 -07:00
. \" -----------------------------------------------------------------
2012-08-30 23:53:29 -07:00
. \" * Define some portability stuff
. \" -----------------------------------------------------------------
. \" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
. \" http://bugs.debian.org/507673
. \" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
. \" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n (.g .ds Aq \(aq
.el .ds Aq '
. \" -----------------------------------------------------------------
2011-08-27 16:28:25 -07:00
. \" * set default formatting
. \" -----------------------------------------------------------------
2006-10-21 08:07:09 +00:00
. \" disable hyphenation
.nh
. \" disable justification (adjust text to left margin only)
2004-09-10 22:58:04 +00:00
.ad l
2011-08-27 16:28:25 -07:00
. \" -----------------------------------------------------------------
. \" * MAIN CONTENT STARTS HERE *
. \" -----------------------------------------------------------------
2006-10-21 08:07:09 +00:00
.SH "NAME"
yasm_arch \- Yasm Supported Target Architectures
.SH "SYNOPSIS"
2011-08-27 16:28:25 -07:00
.HP \w '\fByasm\fR\ 'u
\fB yasm\fR \fB \- a\ \fR \fB \fI arch\fR \fR [\fB \- m\ \fR \fB \fI machine\fR \fR ] \fB \fI \& .\& .\& .\fR \fR
2004-09-10 22:58:04 +00:00
.SH "DESCRIPTION"
.PP
2011-08-27 16:28:25 -07:00
The standard Yasm distribution includes a number of modules for different target architectures\& . Each target architecture can support one or more machine architectures\& .
2006-10-21 08:07:09 +00:00
.PP
The architecture and machine are selected on the
\fB yasm\fR (1)
command line by use of the
\fB \- a \fR \fB \fI arch\fR \fR
and
\fB \- m \fR \fB \fI machine\fR \fR
2011-08-27 16:28:25 -07:00
command line options, respectively\& .
2004-09-10 22:58:04 +00:00
.PP
2011-08-27 16:28:25 -07:00
The machine architecture may also automatically be selected by certain object formats\& . For example, the
2006-10-21 08:07:09 +00:00
\(lq elf32\(rq
object format selects the
\(lq x86\(rq
machine architecture by default, while the
\(lq elf64\(rq
object format selects the
\(lq amd64\(rq
2011-08-27 16:28:25 -07:00
machine architecture by default\& .
2004-09-10 22:58:04 +00:00
.SH "X86 ARCHITECTURE"
.PP
2006-10-21 08:07:09 +00:00
The
\(lq x86\(rq
2011-08-27 16:28:25 -07:00
architecture supports the IA\- 32 instruction set and derivatives and the AMD64 instruction set\& . It consists of two machines:
2006-10-21 08:07:09 +00:00
\(lq x86\(rq
(for the IA\- 32 and derivatives) and
\(lq amd64\(rq
2011-08-27 16:28:25 -07:00
(for the AMD64 and derivatives)\& . The default machine for the
2006-10-21 08:07:09 +00:00
\(lq x86\(rq
architecture is the
\(lq x86\(rq
2011-08-27 16:28:25 -07:00
machine\& .
2004-09-11 07:20:49 +00:00
.SS "BITS Setting"
.PP
2011-08-27 16:28:25 -07:00
The x86 architecture BITS setting specifies to Yasm the processor mode in which the generated code is intended to execute\& . x86 processors can run in three different major execution modes: 16\- bit, 32\- bit, and on AMD64\- supporting processors, 64\- bit\& . As the x86 instruction set contains portions whose function is execution\- mode dependent (such as operand\- size and address\- size override prefixes), Yasm cannot assemble x86 instructions correctly unless it is told by the user in what processor mode the code will execute\& .
2004-09-11 07:20:49 +00:00
.PP
2011-08-27 16:28:25 -07:00
The BITS setting can be changed in a variety of ways\& . When using the NASM\- compatible parser, the BITS setting can be changed directly via the use of the
2006-10-21 08:07:09 +00:00
\fB BITS xx\fR
2011-08-27 16:28:25 -07:00
assembler directive\& . The default BITS setting is determined by the object format in use\& .
2004-09-11 07:20:49 +00:00
.SS "BITS 64 Extensions"
.PP
2011-08-27 16:28:25 -07:00
The AMD64 architecture is a new 64\- bit architecture developed by AMD, based on the 32\- bit x86 architecture\& . It extends the original x86 architecture by doubling the number of general purpose and SIMD registers, extending the arithmetic operations and address space to 64 bits, as well as other features\& .
2004-09-11 07:20:49 +00:00
.PP
2011-08-27 16:28:25 -07:00
Recently, Intel has introduced an essentially identical version of AMD64 called EM64T\& .
2004-09-11 07:20:49 +00:00
.PP
2011-08-27 16:28:25 -07:00
When an AMD64\- supporting processor is executing in 64\- bit mode, a number of additional extensions are available, including extra general purpose registers, extra SSE2 registers, and RIP\- relative addressing\& .
2006-10-21 08:07:09 +00:00
.PP
2011-08-27 16:28:25 -07:00
Yasm extends the base NASM syntax to support AMD64 as follows\& . To enable assembly of instructions for the 64\- bit mode of AMD64 processors, use the directive
2012-08-30 23:53:29 -07:00
\fB BITS 64\fR \& . As with NASM\* (Aqs BITS directive, this does not change the format of the output object file to 64 bits; it only changes the assembler mode to assume that the instructions being assembled will be run in 64\- bit mode\& . To specify an AMD64 object file, use
2006-10-21 08:07:09 +00:00
\fB \- m amd64\fR
on the Yasm command line, or explicitly target a 64\- bit object format such as
\fB \- f win64\fR
or
2011-08-27 16:28:25 -07:00
\fB \- f elf64\fR \& .
2012-08-30 23:53:29 -07:00
\fB \- f elfx32\fR
can be used to select 32\- bit ELF object format for AMD64 processors\& .
2006-10-21 08:07:09 +00:00
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
2011-08-27 16:28:25 -07:00
.ps +1
2006-10-21 08:07:09 +00:00
\fB Register Changes\fR
2011-08-27 16:28:25 -07:00
.RS 4
2006-10-21 08:07:09 +00:00
.PP
2011-08-27 16:28:25 -07:00
The additional 64\- bit general purpose registers are named r8\- r15\& . There are also 8\- bit (rXb), 16\- bit (rXw), and 32\- bit (rXd) subregisters that map to the least significant 8, 16, or 32 bits of the 64\- bit register\& . The original 8 general purpose registers have also been extended to 64\- bits: eax, edx, ecx, ebx, esi, edi, esp, and ebp have new 64\- bit versions called rax, rdx, rcx, rbx, rsi, rdi, rsp, and rbp respectively\& . The old 32\- bit registers map to the least significant bits of the new 64\- bit registers\& .
2006-10-21 08:07:09 +00:00
.PP
2011-08-27 16:28:25 -07:00
New 8\- bit registers are also available that map to the 8 least significant bits of rsi, rdi, rsp, and rbp\& . These are called sil, dil, spl, and bpl respectively\& . Unfortunately, due to the way instructions are encoded, these new 8\- bit registers are encoded the same as the old 8\- bit registers ah, dh, ch, and bh\& . The processor tells which is being used by the presence of the new REX prefix that is used to specify the other extended registers\& . This means it is illegal to mix the use of ah, dh, ch, and bh with an instruction that requires the REX prefix for other reasons\& . For instance:
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
2004-09-11 07:20:49 +00:00
add ah, [r10]
2006-10-21 08:07:09 +00:00
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2004-09-11 07:20:49 +00:00
.PP
2011-08-27 16:28:25 -07:00
(NASM syntax) is not a legal instruction because the use of r10 requires a REX prefix, making it impossible to use ah\& .
2004-09-11 07:20:49 +00:00
.PP
2011-08-27 16:28:25 -07:00
In 64\- bit mode, an additional 8 SSE2 registers are also available\& . These are named xmm8\- xmm15\& .
2006-10-21 08:07:09 +00:00
.RE
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
2011-08-27 16:28:25 -07:00
.ps +1
2006-10-21 08:07:09 +00:00
\fB 64 Bit Instructions\fR
2011-08-27 16:28:25 -07:00
.RS 4
2004-09-11 07:20:49 +00:00
.PP
2011-08-27 16:28:25 -07:00
By default, most operations in 64\- bit mode remain 32\- bit; operations that are 64\- bit usually require a REX prefix (one bit in the REX prefix determines whether an operation is 64\- bit or 32\- bit)\& . Thus, essentially all 32\- bit instructions have a 64\- bit version, and the 64\- bit versions of instructions can use extended registers
2006-10-21 08:07:09 +00:00
\(lq for free\(rq
2011-08-27 16:28:25 -07:00
(as the REX prefix is already present)\& . Examples in NASM syntax:
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
2004-09-11 07:20:49 +00:00
mov eax, 1 ; 32\- bit instruction
2006-10-21 08:07:09 +00:00
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
2004-09-11 07:20:49 +00:00
mov rcx, 1 ; 64\- bit instruction
2006-10-21 08:07:09 +00:00
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2004-09-11 07:20:49 +00:00
.PP
2011-08-27 16:28:25 -07:00
Instructions that modify the stack (push, pop, call, ret, enter, and leave) are implicitly 64\- bit\& . Their 32\- bit counterparts are not available, but their 16\- bit counterparts are\& . Examples in NASM syntax:
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
2004-09-11 07:20:49 +00:00
push eax ; illegal instruction
2006-10-21 08:07:09 +00:00
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
2004-09-11 07:20:49 +00:00
push rbx ; 1\- byte instruction
2006-10-21 08:07:09 +00:00
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
2004-09-11 07:20:49 +00:00
push r11 ; 2\- byte instruction with REX prefix
2006-10-21 08:07:09 +00:00
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.RE
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
2011-08-27 16:28:25 -07:00
.ps +1
2006-10-21 08:07:09 +00:00
\fB Implicit Zero Extension\fR
2011-08-27 16:28:25 -07:00
.RS 4
2004-09-11 07:20:49 +00:00
.PP
2011-08-27 16:28:25 -07:00
Results of 32\- bit operations are implicitly zero\- extended to the upper 32 bits of the corresponding 64\- bit register\& . 16 and 8 bit operations, on the other hand, do not affect upper bits of the register (just as in 32\- bit and 16\- bit modes)\& . This can be used to generate smaller code in some instances\& . Examples in NASM syntax:
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
2004-09-11 07:20:49 +00:00
mov ecx, 1 ; 1 byte shorter than mov rcx, 1
2006-10-21 08:07:09 +00:00
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
2004-09-12 21:06:45 +00:00
and edx, 3 ; equivalent to and rdx, 3
2006-10-21 08:07:09 +00:00
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.RE
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
2011-08-27 16:28:25 -07:00
.ps +1
2006-10-21 08:07:09 +00:00
\fB Immediates\fR
2011-08-27 16:28:25 -07:00
.RS 4
2004-09-11 07:20:49 +00:00
.PP
2011-08-27 16:28:25 -07:00
For most instructions in 64\- bit mode, immediate values remain 32 bits; their value is sign\- extended into the upper 32 bits of the target register prior to being used\& . The exception is the mov instruction, which can take a 64\- bit immediate when the destination is a 64\- bit register\& . Examples in NASM syntax:
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
add rax, 1 ; optimized down to signed 8\- bit
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
add rax, dword 1 ; force size to 32\- bit
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
add rax, 0xffffffff ; sign\- extended 32\- bit
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
add rax, \- 1 ; same as above
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
add rax, 0xffffffffffffffff ; truncated to 32\- bit (warning)
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
mov eax, 1 ; 5 byte
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
mov rax, 1 ; 5 byte (optimized to signed 32\- bit)
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
mov rax, qword 1 ; 10 byte (forced 64\- bit)
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
mov rbx, 0x1234567890abcdef ; 10 byte
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
mov rcx, 0xffffffff ; 10 byte (does not fit in signed 32\- bit)
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
mov ecx, \- 1 ; 5 byte, equivalent to above
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
mov rcx, sym ; 5 byte, 32\- bit size default for symbols
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
mov rcx, qword sym ; 10 byte, override default size
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.PP
2011-08-27 16:28:25 -07:00
The handling of mov reg64, unsized immediate is different between YASM and NASM 2\& .x; YASM follows the above behavior, while NASM 2\& .x does the following:
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
add rax, 0xffffffff ; sign\- extended 32\- bit immediate
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
add rax, \- 1 ; same as above
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
add rax, 0xffffffffffffffff ; truncated 32\- bit (warning)
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
add rax, sym ; sign\- extended 32\- bit immediate
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov eax, 1 ; 5 byte (32\- bit immediate)
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov rax, 1 ; 10 byte (64\- bit immediate)
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov rbx, 0x1234567890abcdef ; 10 byte instruction
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov rcx, 0xffffffff ; 10 byte instruction
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov ecx, \- 1 ; 5 byte, equivalent to above
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov ecx, sym ; 5 byte (32\- bit immediate)
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov rcx, sym ; 10 byte instruction
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov rcx, qword sym ; 10 byte (64\- bit immediate)
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.RE
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
2011-08-27 16:28:25 -07:00
.ps +1
2006-10-21 08:07:09 +00:00
\fB Displacements\fR
2011-08-27 16:28:25 -07:00
.RS 4
2006-10-21 08:07:09 +00:00
.PP
2011-08-27 16:28:25 -07:00
Just like immediates, displacements, for the most part, remain 32 bits and are sign extended prior to use\& . Again, the exception is one restricted form of the mov instruction: between the al/ax/eax/rax register and a 64\- bit absolute address (no registers allowed in the effective address)\& . In NASM syntax, use of the 64\- bit absolute form requires
\fB [qword]\fR \& . Examples in NASM syntax:
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
2004-09-11 07:20:49 +00:00
mov eax, [1] ; 32 bit, with sign extension
2006-10-21 08:07:09 +00:00
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
2004-09-11 07:20:49 +00:00
mov al, [rax\- 1] ; 32 bit, with sign extension
2006-10-21 08:07:09 +00:00
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
2004-09-11 07:20:49 +00:00
mov al, [qword 0x1122334455667788] ; 64\- bit absolute
2006-10-21 08:07:09 +00:00
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
2004-09-11 07:20:49 +00:00
mov al, [0x1122334455667788] ; truncated to 32\- bit (warning)
2006-10-21 08:07:09 +00:00
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.RE
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
2011-08-27 16:28:25 -07:00
.ps +1
2006-10-21 08:07:09 +00:00
\fB RIP Relative Addressing\fR
2011-08-27 16:28:25 -07:00
.RS 4
2004-09-11 07:20:49 +00:00
.PP
2011-08-27 16:28:25 -07:00
In 64\- bit mode, a new form of effective addressing is available to make it easier to write position\- independent code\& . Any memory reference may be made RIP relative (RIP is the instruction pointer register, which contains the address of the location immediately following the current instruction)\& .
2004-09-11 07:20:49 +00:00
.PP
In NASM syntax, there are two ways to specify RIP\- relative addressing:
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
2004-09-11 07:20:49 +00:00
mov dword [rip+10], 1
2006-10-21 08:07:09 +00:00
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2004-09-11 07:20:49 +00:00
.PP
2011-08-27 16:28:25 -07:00
stores the value 1 ten bytes after the end of the instruction\& .
2006-10-21 08:07:09 +00:00
\fB 10\fR
2011-08-27 16:28:25 -07:00
can also be a symbolic constant, and will be treated the same way\& . On the other hand,
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
2004-09-11 07:20:49 +00:00
mov dword [symb wrt rip], 1
2006-10-21 08:07:09 +00:00
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2004-09-11 07:20:49 +00:00
.PP
2006-10-21 08:07:09 +00:00
stores the value 1 into the address of symbol
2011-08-27 16:28:25 -07:00
\fB symb\fR \& . This is distinctly different than the behavior of:
2006-10-21 08:07:09 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.nf
2004-09-11 07:20:49 +00:00
mov dword [symb+rip], 1
2006-10-21 08:07:09 +00:00
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2006-10-21 08:07:09 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2004-09-11 07:20:49 +00:00
.PP
2006-10-21 08:07:09 +00:00
which takes the address of the end of the instruction, adds the address of
\fB symb\fR
2011-08-27 16:28:25 -07:00
to it, then stores the value 1 there\& . If
2006-10-21 08:07:09 +00:00
\fB symb\fR
is a variable, this will
\fI not\fR
store the value 1 into the
\fB symb\fR
variable!
2007-11-03 04:59:28 +00:00
.PP
Yasm also supports the following syntax for RIP\- relative addressing:
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov [rel sym], rax ; RIP\- relative
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov [abs sym], rax ; not RIP\- relative
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.PP
The behavior of:
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov [sym], rax
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.PP
2011-08-27 16:28:25 -07:00
Depends on a mode set by the DEFAULT directive, as follows\& . The default mode is always "abs", and in "rel" mode, use of registers, an fs or gs segment override, or an explicit "abs" override will result in a non\- RIP\- relative effective address\& .
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
default rel
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov [sym], rbx ; RIP\- relative
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov [abs sym], rbx ; not RIP\- relative (explicit override)
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov [rbx+1], rbx ; not RIP\- relative (register use)
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov [fs:sym], rbx ; not RIP\- relative (fs or gs use)
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov [ds:sym], rbx ; RIP\- relative (segment, but not fs or gs)
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov [rel sym], rbx ; RIP\- relative (redundant override)
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
default abs
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov [sym], rbx ; not RIP\- relative
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov [abs sym], rbx ; not RIP\- relative
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov [rbx+1], rbx ; not RIP\- relative
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov [fs:sym], rbx ; not RIP\- relative
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov [ds:sym], rbx ; not RIP\- relative
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov [rel sym], rbx ; RIP\- relative (explicit override)
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.RE
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
2011-08-27 16:28:25 -07:00
.ps +1
2007-11-03 04:59:28 +00:00
\fB Memory references\fR
2011-08-27 16:28:25 -07:00
.RS 4
2007-11-03 04:59:28 +00:00
.PP
2012-08-30 23:53:29 -07:00
Usually the size of a memory reference can be deduced by which registers you\* (Aqre moving\- \- for example, "mov [rax],ecx" is a 32\- bit move, because ecx is 32 bits\& . YASM currently gives the non\- obvious "invalid combination of opcode and operands" error if it can\* (Aqt figure out how much memory you\* (Aqre moving\& . The fix in this case is to add a memory size specifier: qword, dword, word, or byte\& .
2007-11-03 04:59:28 +00:00
.PP
2012-08-30 23:53:29 -07:00
Here\* (Aqs a 64\- bit memory move, which sets 8 bytes starting at rax:
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov qword [rax], 1
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.PP
2012-08-30 23:53:29 -07:00
Here\* (Aqs a 32\- bit memory move, which sets 4 bytes:
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov dword [rax], 1
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.PP
2012-08-30 23:53:29 -07:00
Here\* (Aqs a 16\- bit memory move, which sets 2 bytes:
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov word [rax], 1
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.PP
2012-08-30 23:53:29 -07:00
Here\* (Aqs an 8\- bit memory move, which sets 1 byte:
2007-11-03 04:59:28 +00:00
.sp
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RS 4
2011-08-27 16:28:25 -07:00
. \}
2007-11-03 04:59:28 +00:00
.nf
mov byte [rax], 1
.fi
2011-08-27 16:28:25 -07:00
.if n \{ \
2007-11-03 04:59:28 +00:00
.RE
2011-08-27 16:28:25 -07:00
. \}
2006-10-21 08:07:09 +00:00
.RE
2004-09-10 22:58:04 +00:00
.SH "LC3B ARCHITECTURE"
.PP
2006-10-21 08:07:09 +00:00
The
\(lq lc3b\(rq
2011-08-27 16:28:25 -07:00
architecture supports the LC\- 3b ISA as used in the ECE 312 (now ECE 411) course at the University of Illinois, Urbana\- Champaign, as well as other university courses\& . See
\m[blue]\fB\%http://courses.ece.uiuc.edu/ece411/\fR\m[]
for more details and example code\& . The
2006-10-21 08:07:09 +00:00
\(lq lc3b\(rq
architecture consists of only one machine:
2011-08-27 16:28:25 -07:00
\(lq lc3b\(rq \& .
2004-09-10 22:58:04 +00:00
.SH "SEE ALSO"
.PP
\fB yasm\fR (1)
.SH "BUGS"
.PP
2006-10-21 08:07:09 +00:00
When using the
\(lq x86\(rq
architecture, it is overly easy to generate AMD64 code (using the
\fB BITS 64\fR
directive) and generate a 32\- bit object file (by failing to specify
\fB \- m amd64\fR
2011-08-27 16:28:25 -07:00
on the command line or selecting a 64\- bit object format)\& . Similarly, specifying
2006-10-21 08:07:09 +00:00
\fB \- m amd64\fR
2011-08-27 16:28:25 -07:00
does not default the BITS setting to 64\& . An easy way to avoid this is by directly specifying a 64\- bit object format such as
\fB \- f elf64\fR \& .
2006-10-21 08:07:09 +00:00
.SH "AUTHOR"
.PP
2011-08-27 16:28:25 -07:00
\fB Peter Johnson\fR <\& peter@tortall\& .net\& >
.RS 4
2006-10-21 08:07:09 +00:00
Author.
2011-08-27 16:28:25 -07:00
.RE
2006-10-21 08:07:09 +00:00
.SH "COPYRIGHT"
2011-08-27 16:28:25 -07:00
.br
2007-11-03 04:59:28 +00:00
Copyright \(co 2004, 2005, 2006, 2007 Peter Johnson
.br