3atv精品不卡视频,97人人超碰国产精品最新,中文字幕av一区二区三区人妻少妇,久久久精品波多野结衣,日韩一区二区三区精品

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 综合教程 >内容正文

综合教程

YASM User Manual

發布時間:2023/12/13 综合教程 35 生活家
生活随笔 收集整理的這篇文章主要介紹了 YASM User Manual 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

This document is the user manual for the Yasm assembler. It is intended as both an introduction and a general-purpose reference for all Yasm users.

1.Introduction

Yasm is a BSD-licensed assembler that is designed from the ground up to allow for multiple assembler syntaxes to be supported (e.g. NASM, GNU AS, etc.) in addition to multiple output object formats and multiple instruction sets. Its modular architecture allows additional object formats, debug formats, and syntaxes to be added relatively easily.

Yasm started life in 2001 as a rewrite of the NASM (Netwide) x86 assembler under the BSD license. Since then, it has matched and exceeded NASM's capabilities, incorporating features such as supporting the 64-bit AMD64 architecture, parsing GNU AS syntax, and generating STABS, DWARF2, and CodeView 8 debugging information.

2.License

Yasm is licensed under the 2-clause and 3-clause"revised"BSD licenses, with one exception: the Bit::Vector module used by the mainline version of Yasm to implement its large integer and machine-independent floating point support is triple-licensed under the Artistic license, GPL, and LGPL. The"yasm-nextgen"codebase uses a different BSD-licensed implementation and is thus entirely under BSD-equivalent licenses. The full text of the licenses are provided in the Yasm source distribution.

This user manual is licensed under the 2-clause BSD license.

3.Material Covered in this Book

This book is intended to be a user's manual for Yasm, serving as both an introduction and a general-purpose reference. While mentions may be made in various sections of Yasm's implementation (usually to explain the reasons behind bugs or unusual aspects to various features), this book will not go into depth explaining how Yasm does its job; for an in-depth discussion of Yasm's internals, seeThe Design and Implementation of the Yasm Assembler.

PartI.Using Yasm

1.1.yasmSynopsis

yasm[-fformat] [-ooutfile] [other options...] {infile}

1.2.Description

Theyasmcommand assembles the fileinfileand directs output to the fileoutfileif specified. Ifoutfileis not specified,yasmwill derive a default output file name from the name of its input file, usually by appending.oor.obj, or by removing all extensions for a raw binary file. Failing that, the output file name will beyasm.out.

If called with aninfileof"-",yasmassembles the standard input and directs output to the fileoutfile, oryasm.outif nooutfileis specified.

If errors or warnings are discovered during execution, Yasm outputs the error message tostderr(usually the terminal). If no errors or warnings are encountered, Yasm does not output any messages.

1.3.Options

Many options may be given in one of two forms: either a dash followed by a single letter, or two dashes followed by a long option name. Options are listed in alphabetical order.

1.3.1.General Options

1.3.1.1.-aarchor--arch=arch: Select target architecture

Selects the target architecture. The default architecture is"x86", which supports both the IA-32 and derivatives and AMD64 instruction sets. To print a list of available architectures to standard output, use"help"asarch. SeeSection1.4for a list of supported architectures.

1.3.1.2.-fformator--oformat=format: Select object format

Selects the output object format. The default object format is"bin", which is a flat format binary with no relocation. To print a list of available object formats to standard output, use"help"asformat. SeeSection1.6for a list of supported object formats.

1.3.1.3.-gdebugor--dformat=debug: Select debugging format

Selects the debugging format for debug information. Debugging information can be used by a debugger to associate executable code back to the source file or get data structure and type information. Available debug formats vary between different object formats;yasmwill error when an invalid combination is selected. The default object format is selected by the object format. To print a list of available debugging formats to standard output, use"help"asdebug. SeeSection1.7for a list of supported debugging formats.

1.3.1.4.-hor--help: Print a summary of options

Prints a summary of invocation options. All other options are ignored, and no output file is generated.

1.3.1.5.-Llistor--lformat=list: Select list file format

Selects the format/style of the output list file. List files typically intermix the original source with the machine code generated by the assembler. The default list format is"nasm", which mimics the NASM list file format. To print a list of available list file formats to standard output, use"help"aslist.

1.3.1.6.-llistfileor--list=listfile: Specify list filename

Specifies the name of the output list file. If this option is not used, no list file is generated.

1.3.1.7.-mmachineor--machine=machine: Select target machine architecture

Selects the target machine architecture. Essentially a subtype of the selected architecture, the machine type selects between major subsets of an architecture. For example, for the"x86"architecture, the two available machines are"x86", which is used for the IA-32 and derivative 32-bit instruction set, and"amd64", which is used for the 64-bit instruction set. This differentiation is required to generate the proper object file for relocatable object formats such as COFF and ELF. To print a list of available machines for a given architecture to standard output, use"help"asmachineand the given architecture using-aarch. SeePartVIfor more details.

1.3.1.8.-ofilenameor--objfile=filename: Specify object filename

Specifies the name of the output file, overriding any default name generated by Yasm.

1.3.1.9.-pparseror--parser=parser: Select parser

Selects the parser (the assembler syntax). The default parser is"nasm", which emulates the syntax of NASM, the Netwide Assembler. Another available parser is"gas", which emulates the syntax of GNU AS. To print a list of available parsers to standard output, use"help"asparser. SeeSection1.5for a list of supported parsers.

1.3.1.10.-rpreprocor--preproc=preproc: Select preprocessor

Selects the preprocessor to use on the input file before passing it to the parser. Preprocessors often provide macro functionality that is not included in the main parser. The default preprocessor is"nasm", which is an imported version of the actual NASM preprocessor. A"raw"preprocessor is also available, which simply skips the preprocessing step, passing the input file directly to the parser. To print a list of available preprocessors to standard output, use"help"aspreproc.

1.3.1.11.--version: Get the Yasm version

This option causes Yasm to prints the version number of Yasm as well as a license summary to standard output. All other options are ignored, and no output file is generated.

1.3.2.Warning Options

-Woptions have two contrary forms:-W?name?and-Wno-name. Only the non-default forms are shown here.

The warning options are handled in the order given on the command line, so if-wis followed by-Worphan-labels, all warnings are turned offexceptfor orphan-labels.

1.3.2.1.-w: Inhibit all warning messages

This option causes Yasm to inhibit all warning messages. As discussed above, this option may be followed by other options to re-enable specified warnings.

1.3.2.2.-Werror: Treat warnings as errors

This option causes Yasm to treat all warnings as errors. Normally warnings do not prevent an object file from being generated and do not result in a failure exit status fromyasm, whereas errors do. This option makes warnings equivalent to errors in terms of this behavior.

1.3.2.3.-Wno-unrecognized-char: Do not warn on unrecognized input characters

Causes Yasm to not warn on unrecognized characters found in the input. Normally Yasm will generate a warning for any non-ASCII character found in the input file.

1.3.2.4.-Worphan-labels: Warn on labels lacking a trailing colon

When using the NASM-compatible parser, causes Yasm to warn about labels found alone on a line without a trailing colon. While these are legal labels in NASM syntax, they may be unintentional, due to typos or macro definition ordering.

1.3.2.5.-Xstyle: Change error/warning reporting style

Selects a specific output style for error and warning messages. The default is"gnu"style, which mimics the output ofgcc. The"vc"style is also available, which mimics the output of Microsoft's Visual Studio compiler.

This option is available so that Yasm integrates more naturally into IDE environments such asVisual StudioorEmacs, allowing the IDE to correctly recognize the error/warning message as such and link back to the offending line of source code.

1.3.3.Preprocessor Options

While these preprocessor options theoretically will affect any preprocessor, the only preprocessor currently in Yasm is the"nasm"preprocessor.

1.3.3.1.-Dmacro[=value]: Pre-define a macro

Pre-defines a single-line macro. The value is optional (if no value is given, the macro is still defined, but to an empty value).

1.3.3.2.-eor--preproc-only: Only preprocess

Stops assembly after the preprocessing stage; preprocessed output is sent to the specified output name or, if no output name is specified, the standard output. No object file is produced.

1.3.3.3.-Ipath: Add include file path

Adds directorypathto the search path for include files. The search path defaults to only including the directory in which the source file resides.

1.3.3.4.-Pfilename: Pre-include a file

Pre-includes filefilename, making it look as thoughfilenamewas prepended to the input. Can be useful for prepending multi-line macros that the-Dcan't support.

1.3.3.5.-Umacro: Undefine a macro

Undefines a single-line macro (may be either a built-in macro or one defined earlier in the command line with-D(seeSection1.3.3.1).

1.4.Supported Target Architectures

Yasm supports the following instruction set architectures (ISAs). For more details seePartVI.

x86

The"x86"architecture supports the IA-32 instruction set and derivatives (including 16-bit and non-Intel instructions) and the AMD64 instruction set. It consists of two machines:"x86"(for the IA-32 and derivatives) and"amd64"(for the AMD64 and derivatives). The default machine for the"x86"architecture is the"x86"machine.

1.5.Supported Parsers (Syntaxes)

Yasm parses the following assembler syntaxes:

nasm

NASM syntax is the most full-featured syntax supported by Yasm. Yasm is nearly 100% compatible with NASM for 16-bit and 32-bit x86 code. Yasm additionally supports 64-bit AMD64 code with Yasm extensions to the NASM syntax. For more details seePartII.

gas

The GNU Assembler (GAS) is the de-facto cross-platform assembler for modern Unix systems, and is used as the backend for the GCC compiler. Yasm's support for GAS syntax is moderately good, although immature: not all directives are supported, and only 32-bit x86 and AMD64 architectures are supported. There is also no support for the GAS preprocessor. Despite these limitations, Yasm's GAS syntax support is good enough to handle essentially all x86 and AMD64 GCC compiler output. For more details seePartIII.

1.6.Supported Object Formats

Yasm supports the following object formats. More details can be found inPartIV.

bin

The"bin"object format produces a flat-format, non-relocatable binary file. It is appropriate for producing DOS .COM executables or things like boot blocks. It supports only 3 sections and those sections are written in a predefined order to the output file.

coff

The COFF object format is an older relocatable object format used on older Unix and compatible systems, and also (more recently) on the DJGPP development system for DOS.

dbg

The"dbg"object format is not a"real"object format; the output file it creates simply describes the sequence of calls made to it by Yasm and the final object and symbol table information in a human-readable text format (that in a normal object format would get processed into that object format's particular binary representation). This object format is not intended for real use, but rather for debugging Yasm's internals.

elf

The ELF object format really comes in three flavors:"elf32"(for 32-bit targets),"elf64"(for 64-bit targets), and"elfx32"(for x32 targets). ELF is a standard object format in common use on modern Unix and compatible systems (e.g. Linux, FreeBSD). ELF has complex support for relocatable and shared objects.

macho

The Mach-O object format really comes in two flavors:"macho32"(for 32-bit targets) and"macho64"(for 64-bit targets). Mach-O is used as the object format on MacOS X. As Yasm currently only supports x86 and AMD64 instruction sets, it can only generate Mach-O objects for Intel-based Macs.

rdf

The RDOFF2 object format is a simple multi-section format originally designed for NASM. It supports segment references but not WRT references. It was designed primarily for simplicity and has minimalistic headers for ease of loading and linking. A complete toolchain (linker, librarian, and loader) is distributed with NASM.

win32

The Win32 object format produces object files compatible with Microsoft compilers (such as Visual Studio) that target the 32-bit x86 Windows platform. The object format itself is an extended version of COFF.

win64

The Win64 object format produces object files compatible with Microsoft compilers that target the 64-bit"x64"Windows platform. This format is very similar to the win32 object format, but produces 64-bit objects.

xdf

The XDF object format is essentially a simplified version of COFF. It's a multi-section relocatable format that supports 64-bit physical and virtual addresses.

1.7.Supported Debugging Formats

Yasm supports generation of source-level debugging information in the following formats. More details can be found inPartV.

cv8

The CV8 debug format is used by Microsoft Visual Studio 2005 (version 8.0) and is completely undocumented, although it bears strong similarities to earlier CodeView formats. Yasm's support for the CV8 debug format is currently limited to generating assembly-level line number information (to allow some level of source-level debugging). The CV8 debug information is stored in the.debug$Sand.debug$Tsections of the Win64 object file.

dwarf2

The DWARF 2 debug format is a complex, well-documented standard for debugging information. It was created to overcome shortcomings in STABS, allowing for much more detailed and compact descriptions of data structures, data variable movement, and complex language structures such as in C. The debugging information is stored in sections (just like normal program sections) in the object file. Yasm supports full pass-through of DWARF2 debugging information (e.g. from a Ccompiler), and can also generate assembly-level line number information.

null

The"null"debug format is a placeholder; it adds no debugging information to the output file.

stabs

The STABS debug format is a poorly documented, semi-standard format for debugging information in COFF and ELF object files. The debugging information is stored as part of the object file's symbol table and thus is limited in complexity and scope. Despite this, STABS is a common debugging format on older Unix and compatible systems, as well as DJGPP.

Chapter2.VSYASM- Yasm for Microsoft Visual Studio 2010

Table of Contents

2.1. Integration Steps

2.2. Alternative Integration Steps

2.3. Using VSYASM

The build system used inMicrosoft Visual Studio 2010 is based onMSBUILD, Microsoft's dedicated build management tool, a change that requires that external tools are integrated into the development environment in a new way.VSYASMhas been developed to facilitate Yasm integration withVisual Studio 2010 in a robust and efficient manner. The main difference between VSYASM and other versions is that it is capable of assembling multiple source code files given on a single command line.

When assembling a single file VSYASM behaves in the same way as the normalyasmtool. The only change in this case is that VSYASM doesn't offer the pre-process only mode.

If however the VSYASM command line includes multiple source files, any output, list and map paths given on the command line are resolved to their directory components alone and each source code file is then assembled using these directories for the relevant outputs. Before assembly starts, any non-existent directories needed for VSYASM outputs are recursively created. The assembly process itself stops if any file being assembled generates errors.

The-Efilecommand line switch can be used to send error reports to a file, in which case this file will also include the command line used to invoke VSYASM. This provides a way to check that VSYASM is being called correctly from the controlling Visual Studio build process.

2.1.Integration Steps

Firstly, the VSYASM executable file (vsyasm.exe) should be added to the Visual Studio directory holding the C tools. This is typically at:

C:Program Files (x86)Microsoft Visual Studio 10.0VCin

Secondly, the three files--vsyasm.xml,vsyasm.propsandvsyasm.targets--should be added into the project directory of the project in which VSYASM is being used (an alternative will be explained later).

Thirdly, to add Yasm support to a project after the project has been opened in the IDE, right click on the project in the solution explorer and select"Build Customisations…". If vsyasm is offered as an option in the resulting list you can then select it; if not, use the"Find Existing…"button and the resulting file dialogue to navigate to thevsyasm.targetsthat you put in the project directory, select it to add it to the list and then select it from the list.

Once you have done this, right clicking on the project in the solution explorer and selecting"Properties"will bring up a dialogue with a new item"Yasm Assembler"that will allow you to configure Yasm for building any assembler files added to the project.

2.2.Alternative Integration Steps

If you have many projects that use VSYASM, you can put the three files mentioned above into MSBUILD's build customisation directory which is typically at:

C:Program Files (x86)MSBuildMicrosoft.Cppv4.0BuildCustomizations

VSYASM will then always be available in the Build Customisations dialogue. An alternative way of doing this is to put these files in a convenient location and then add the path to this location to the"Build Customisations Search Path"item under"VC++ Project Settings"in the Visual Studio 2010 Options dialogue.

2.3.Using VSYASM

In a Visual Studio project with assembler source code files, Yasm settings are entered in the"Yasm Assembler"item in the projects Property Dialogue. The items available correspond with those available on Yasm's command line and are mostly self explanatory but one item--"Object Filename"--does need further explanation.

If the"Object Filename"item refers to a directory (the default), MSBUILD will collect all the assembler files in the project together as a batch and invoke VSYASM in multiple file mode. In order to assemble files one at a time it is necessary to change this to the name of an outputfilesuch as, for example,"$(IntDir)%(Filename).obj".

PartII.NASM Syntax

The chapters in this part of the book document the NASM-compatible syntax accepted by the Yasm"nasm"parser and preprocessor.

3.1.Layout of a NASM Source Line

Like most assemblers, each NASM source line contains (unless it is a macro, a preprocessor directive or an assembler directive: seeChapter5) some combination of the four fields

label: instruction operands ; comment

As usual, most of these fields are optional; the presence or absence of any combination of a label, an instruction and a comment is allowed. Of course, the operand field is either required or forbidden by the presence and nature of the instruction field.

NASM uses backslash () as the line continuation character; if a line ends with backslash, the next line is considered to be a part of the backslash-ended line.

NASM places no restrictions on white space within a line: labels may have white space before them, or instructions may have no space before them, or anything. Thecolon after a label is also optional. Note that this means that if you intend to codelodsbalone on a line, and typelodabby accident, then that's still a valid source line which does nothing but define a label. Running NASM with the command-line option-w+orphan-labelswill cause it to warn you if you define a label alone on a line without a trailing colon.

Valid characters in labels are letters, numbers,_,$,#,@,~,., and?. The only characters which may be used as thefirstcharacter of an identifier are letters,.(with special meaning: seeSection3.9),_and?. An identifier may also be prefixed with a$to indicate that it is intended to be read as an identifier and not a reserved word; thus, if some other module you are linking with defines a symbol calledeax, you can refer to$eaxin NASM code to distinguish the symbol from the register.

The instruction field may contain any machine instruction: Pentium and P6 instructions, FPU instructions, MMX instructions and even undocumented instructions are all supported. The instruction may be prefixed byLOCK,REP,REPE/REPZorREPNE/REPNZ, in the usual way. Explicit address-size andoperand-size prefixesA16,A32,O16andO32are provided. You can also use the name of a segment register as an instruction prefix: codinges mov [bx],axis equivalent to codingmov [es:bx],ax. We recommend the latter syntax, since it is consistent with other syntactic features of the language, but for instructions such asLODSB, which has no operands and yet can require asegment override, there is no clean syntactic way to proceed apart fromes lodsb.

An instruction is not required to use a prefix: prefixes such asCS,A32,LOCKorREPEcan appear on a line by themselves, and NASM will just generate the prefix bytes.

In addition to actual machine instructions, NASM also supports a number of pseudo-instructions, described inSection3.2.

Instructionoperands may take a number of forms: they can be registers, described simply by the register name (e.g.AX,BP,EBX,CR0): NASM does not use thegas-style syntax in which register names must be prefixed by a%sign), or they can beeffective addresses (seeSection3.3), constants (Section3.5) or expressions (Section3.6).

Forfloating-point instructions, NASM accepts a wide range of syntaxes: you can use two-operand forms like MASM supports, or you can use NASM's native single-operand forms in most cases. For example, you can code:

fadd st1 ; this sets st0 := st0 + st1

fadd st0, st1 ; so does this


fadd st1, st0 ; this sets st1 := st1 + st0

fadd to st1 ; so does this

Almost any floating-point instruction that references memory must use one of the prefixesDWORD,QWORD,TWORD,DDQWORD, orOWORDto indicate what size of ((memory operand)) it refers to.

3.2.Pseudo-Instructions

Pseudo-instructions are things which, though not real x86 machine instructions, are used in the instruction field anyway because that's the most convenient place to put them. The currentpseudo-instructions areDB,DW,DD,DQ,DT,DDQ,DO, their uninitialized counterpartsRESB,RESW,RESD,RESQ,REST,RESDDQ, andRESO, theINCBINcommand, theEQUcommand, and theTIMESprefix.

3.2.1.DBand Friends: Declaring Initialized Data

DB,DW,DD,DQ,DT,DDQ, andDOare used to declare initialized data in the output file. They can be invoked in a wide range of ways:

db 0x55 ; just the byte 0x55

db 0x55,0x56,0x57 ; three bytes in succession

db 'a',0x55 ; character constants are OK

db 'hello',13,10,'$' ; so are string constants

dw 0x1234 ; 0x34 0x12

dw 'a' ; 0x41 0x00 (it's just a number)

dw 'ab' ; 0x41 0x42 (character constant)

dw 'abc' ; 0x41 0x42 0x43 0x00 (string)

dd 0x12345678 ; 0x78 0x56 0x34 0x12

dq 0x1122334455667788 ; 0x88 0x77 0x66 0x55 0x44 0x33 0x22 0x11

ddq 0x112233445566778899aabbccddeeff00

; 0x00 0xff 0xee 0xdd 0xcc 0xbb 0xaa 0x99

; 0x88 0x77 0x66 0x55 0x44 0x33 0x22 0x11

do 0x112233445566778899aabbccddeeff00 ; same as previous

dd 1.234567e20 ; floating-point constant

dq 1.234567e20 ; double-precision float

dt 1.234567e20 ; extended-precision float

DTdoes not acceptnumeric constants as operands, andDDQdoes not accept float constants as operands. Any size larger thanDDdoes not accept strings as operands.

3.2.2.RESBand Friends: Declaring Uninitialized Data

RESB,RESW,RESD,RESQ,REST,RESDQ, andRESOare designed to be used in the BSS section of a module: they declareuninitialisedstorage space. Each takes a single operand, which is the number of bytes, words, doublewords or whatever to reserve. NASM does not support the MASM/TASM syntax of reserving uninitialised space by writingDW ?or similar things: this is what it does instead. The operand to aRESB-type pseudo-instruction is acritical expression: seeSection3.8.

For example:

buffer: resb 64 ; reserve 64 bytes

wordvar: resw 1 ; reserve a word

realarray resq 10 ; array of ten reals

3.2.3.INCBIN: Including External Binary Files

INCBINincludes a binary file verbatim into the output file. This can be handy for (for example) includinggraphics andsound data directly into a game executable file. However, it is recommended to use this for onlysmallpieces of data. It can be called in one of these three ways:

incbin "file.dat" ; include the whole file

incbin "file.dat",1024 ; skip the first 1024 bytes

incbin "file.dat",1024,512 ; skip the first 1024, and

; actually include at most 512

3.2.4.EQU: Defining Constants

EQUdefines a symbol to a given constant value: whenEQUis used, the source line must contain a label. The action ofEQUis to define the given label name to the value of its (only) operand. This definition is absolute, and cannot change later. So, for example,

message db 'hello, world'

msglen equ $-message

definesmsglento be the constant 12.msglenmay not then be redefined later. This is not apreprocessor definition either: the value ofmsglenis evaluatedonce, using the value of$(seeSection3.6for an explanation of$) at the point of definition, rather than being evaluated wherever it is referenced and using the value of$at the point of reference. Note that the operand to anEQUis also acritical expression (Section3.8).

3.2.5.TIMES: Repeating Instructions or Data

TheTIMESprefix causes the instruction to be assembled multiple times. This is partly present as NASM's equivalent of theDUPsyntax supported by MASM-compatible assemblers, in that you can code

zerobuf: times 64 db 0

or similar things; butTIMESis more versatile than that. The argument toTIMESis not just a numeric constant, but a numericexpression, so you can do things like

buffer: db 'hello, world'

times 64-$+buffer db ' '

which will store exactly enough spaces to make the total length ofbufferup to 64. Finally,TIMEScan be applied to ordinary instructions, so you can code trivialunrolled loops in it:

times 100 movsb

Note that there is no effective difference betweentimes 100 resb 1andresb 100, except that the latter will be assembled about 100 times faster due to the internal structure of the assembler.

The operand toTIMES, like that ofEQUand those ofRESBand friends, is a critical expression (Section3.8).

Note also thatTIMEScan't be applied tomacros: the reason for this is thatTIMESis processed after the macro phase, which allows the argument toTIMESto contain expressions such as64-$+bufferas above. To repeat more than one line of code, or a complex macro, use the preprocessor%repdirective.

3.3.Effective Addresses

Aneffective address is any operand to an instruction which references memory. Effective addresses, in NASM, have a very simple syntax: they consist of an expression evaluating to the desired address, enclosed insquare brackets. For example:

wordvar dw 123

mov ax,[wordvar]

mov ax,[wordvar+1]

mov ax,[es:wordvar+bx]

Anything not conforming to this simple system is not a valid memory reference in NASM, for examplees:wordvar[bx].

More complicated effective addresses, such as those involving more than one register, work in exactly the same way:

mov eax,[ebx*2+ecx+offset]

mov ax,[bp+di+8]

NASM is capable of doingalgebra on these effective addresses, so that things which don't necessarilylooklegal are perfectly all right:

mov eax,[ebx*5] ; assembles as [ebx*4+ebx]

mov eax,[label1*2-label2] ; ie [label1+(label1-label2)]

Some forms of effective address have more than one assembled form; in most such cases NASM will generate the smallest form it can. For example, there are distinct assembled forms for the 32-bit effective addresses[eax*2+0]and[eax+eax], and NASM will generally generate the latter on the grounds that the former requires four bytes to store a zero offset.

NASM has a hinting mechanism which will cause[eax+ebx]and[ebx+eax]to generate different opcodes; this is occasionally useful because[esi+ebp]and[ebp+esi]have different default segment registers.

However, you can force NASM to generate an effective address in a particular form by the use of the keywordsBYTE,WORD,DWORDandNOSPLIT. If you need[eax+3]to be assembled using a double-word offset field instead of the one byte NASM will normally generate, you can code[dword eax+3]. Similarly, you can force NASM to use a byte offset for a small value which it hasn't seen on the first pass (seeSection3.8for an example of such a code fragment) by using[byte eax+offset]. As special cases,[byte eax]will code[eax+0]with a byte offset of zero, and[dword eax]will code it with a double-word offset of zero. The normal form,[eax], will be coded with no offset field.

The form described in the previous paragraph is also useful if you are trying to access data in a 32-bit segment from within 16 bit code. In particular, if you need to access data with a known offset that is larger than will fit in a 16-bit value, if you don't specify that it is a dword offset, NASM will cause the high word of the offset to be lost.

Similarly, NASM will split[eax*2]into[eax+eax]because that allows the offset field to be absent and space to be saved; in fact, it will also split[eax*2+offset]into[eax+eax+offset]. You can combat this behaviour by the use of theNOSPLITkeyword:[nosplit eax*2]will force[eax*2+0]to be generated literally.

3.3.1.64-bit Displacements

InBITS 64mode, displacements, for the most part, remain 32 bits and are sign extended prior to use. The exception is one restricted form of the mov instruction: between anAL,AX,EAX, orRAXregister and a 64-bit absolute address (no registers are allowed in the effective address, and the address cannot be RIP-relative). In NASM syntax, use of the 64-bit absolute form requiresQWORD. Examples in NASM syntax:

mov eax, [1] ; 32 bit, with sign extension

mov al, [rax-1] ; 32 bit, with sign extension

mov al, [qword 0x1122334455667788] ; 64-bit absolute

mov al, [0x1122334455667788] ; truncated to 32-bit (warning)

3.3.2.RIPRelative Addressing

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 madeRIPrelative (RIPis the instruction pointer register, which contains the address of the location immediately following the current instruction).

In NASM syntax, there are two ways to specify RIP-relative addressing:

mov dword [rip+10], 1

stores the value 1 ten bytes after the end of the instruction.10can also be a symbolic constant, and will be treated the same way. On the other hand,

mov dword [symb wrt rip], 1

stores the value 1 into the address of symbolsymb. This is distinctly different than the behavior of:

mov dword [symb+rip], 1

which takes the address of the end of the instruction, adds the address ofsymbto it, then stores the value 1 there. Ifsymbis a variable, this willnotstore the value 1 into thesymbvariable!

Yasm also supports the following syntax for RIP-relative addressing. TheRELkeyword makes it produceRIP-relative addresses, while theABSkeyword makes it produce non-RIP-relative addresses:

mov [rel sym], rax ; RIP-relative

mov [abs sym], rax ; not RIP-relative

The behavior ofmov [sym], raxdepends on a mode set by theDEFAULTdirective (seeSection5.2), as follows. The default mode at Yasm start-up is alwaysABS, and inRELmode, use of registers, aFSorGSsegment override, or an explicitABSoverride will result in a non-RIP-relative effective address.

default rel

mov [sym], rbx ; RIP-relative

mov [abs sym], rbx ; not RIP-relative (explicit override)

mov [rbx+1], rbx ; not RIP-relative (register use)

mov [fs:sym], rbx ; not RIP-relative (fs or gs use)

mov [ds:sym], rbx ; RIP-relative (segment, but not fs or gs)

mov [rel sym], rbx ; RIP-relative (redundant override)

default abs

mov [sym], rbx ; not RIP-relative

mov [abs sym], rbx ; not RIP-relative

mov [rbx+1], rbx ; not RIP-relative

mov [fs:sym], rbx ; not RIP-relative

mov [ds:sym], rbx ; not RIP-relative

mov [rel sym], rbx ; RIP-relative (explicit override)

3.4.Immediate Operands

Immediate operands in NASM may be 8 bits, 16 bits, 32 bits, and even 64 bits in size. The immediate size can be directly specified through the use of theBYTE,WORD, orDWORDkeywords, respectively.

64 bit immediate operands are limited to direct 64-bit register move instructions inBITS 64mode. For all other 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.

All unsized immediate values inBITS 64in Yasm default to 32-bit size for consistency. In order to get a 64-bit immediate with a label, specify the size explicitly with theQWORDkeyword. For ease of use, Yasm will also try to recognize 64-bit values and change the size to 64 bits automatically for these cases.

Examples in NASM syntax:

add rax, 1 ; optimized down to signed 8-bit

add rax, dword 1 ; force size to 32-bit

add rax, 0xffffffff ; sign-extended 32-bit

add rax, -1 ; same as above

add rax, 0xffffffffffffffff ; truncated to 32-bit (warning)

mov eax, 1 ; 5 byte

mov rax, 1 ; 5 byte (optimized to signed 32-bit)

mov rax, qword 1 ; 10 byte (forced 64-bit)

mov rbx, 0x1234567890abcdef ; 10 byte

mov rcx, 0xffffffff ; 10 byte (does not fit in signed 32-bit)

mov ecx, -1 ; 5 byte, equivalent to above

mov rcx, sym ; 5 byte, 32-bit size default for symbols

mov rcx, qword sym ; 10 byte, override default size

A caution for users using both Yasm and NASM 2.x: 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:

add rax, 0xffffffff ; sign-extended 32-bit immediate

add rax, -1 ; same as above

add rax, 0xffffffffffffffff ; truncated 32-bit (warning)

add rax, sym ; sign-extended 32-bit immediate

mov eax, 1 ; 5 byte (32-bit immediate)

mov rax, 1 ; 10 byte (64-bit immediate)

mov rbx, 0x1234567890abcdef ; 10 byte instruction

mov rcx, 0xffffffff ; 10 byte instruction

mov ecx, -1 ; 5 byte, equivalent to above

mov ecx, sym ; 5 byte (32-bit immediate)

mov rcx, sym ; 10 byte (64-bit immediate)

mov rcx, qword sym ; 10 byte, same as above

3.5.Constants

NASM understands four different types of constant: numeric, character, string and floating-point.

3.5.1.Numeric Constants

A numeric constant is simply a number. NASM allows you to specify numbers in a variety of number bases, in a variety of ways: you can suffixH,QorO, andBforhex,octal, andbinary, or you can prefix0xfor hex in the style of C, or you can prefix$for hex in the style of Borland Pascal. Note, though, that the$prefix does double duty as a prefix on identifiers (seeSection3.1), so a hex number prefixed with a$sign must have a digit after the$rather than a letter.

Some examples:

mov ax,100 ; decimal

mov ax,0a2h ; hex

mov ax,$0a2 ; hex again: the 0 is required

mov ax,0xa2 ; hex yet again

mov ax,777q ; octal

mov ax,777o ; octal again

mov ax,10010011b ; binary

3.5.2.Character Constants

A character constant consists of up to four characters enclosed in either single or double quotes. The type of quote makes no difference to NASM, except of course that surrounding the constant with single quotes allows double quotes to appear within it and vice versa.

A character constant with more than one character will be arranged withlittle-endian order in mind: if you code

mov eax,'abcd'

then the constant generated is not0x61626364, but0x64636261, so that if you were then to store the value into memory, it would readabcdrather thandcba. This is also the sense of character constants understood by the Pentium'sCPUIDinstruction.

3.5.3.String Constants

String constants are only acceptable to some pseudo-instructions, namely theDBfamily andINCBIN.

A string constant looks like a character constant, only longer. It is treated as a concatenation of maximum-size character constants for the conditions. So the following are equivalent:

db 'hello' ; string constant

db 'h','e','l','l','o' ; equivalent character constants

And the following are also equivalent:

dd 'ninechars' ; doubleword string constant

dd 'nine','char','s' ; becomes three doublewords

db 'ninechars',0,0,0 ; and really looks like this

Note that when used as an operand todb, a constant like'ab'is treated as a string constant despite being short enough to be a character constant, because otherwisedb 'ab'would have the same effect asdb 'a', which would be silly. Similarly, three-character or four-character constants are treated as strings when they are operands todw.

3.5.4.Floating-Point Constants

Floating-point constants are acceptable only as arguments toDW,DD,DQandDT. They are expressed in the traditional form: digits, then a period, then optionally more digits, then optionally anEfollowed by an exponent. The period is mandatory, so that NASM can distinguish betweendd 1, which declares an integer constant, anddd 1.0which declares a floating-point constant.

Some examples:

dw -0.5 ; IEEE half precision

dd 1.2 ; an easy one

dq 1.e10 ; 10,000,000,000

dq 1.e+10 ; synonymous with 1.e10

dq 1.e-10 ; 0.000 000 000 1

dt 3.141592653589793238462 ; pi

NASM cannot do compile-time arithmetic on floating-point constants. This is because NASM is designed to be portable - although it always generates code to run on x86 processors, the assembler itself can run on any system with an ANSI C compiler. Therefore, the assembler cannot guarantee the presence of a floating-point unit capable of handling theIntel number formats, and so for NASM to be able to do floating arithmetic it would have to include its own complete set of floating-point routines, which would significantly increase the size of the assembler for very little benefit.

3.6.Expressions

Expressions in NASM are similar in syntax to those in C.

NASM does not guarantee the size of the integers used to evaluate expressions at compile time: since NASM can compile and run on 64-bit systems quite happily, don't assume that expressions are evaluated in 32-bit registers and so try to make deliberate use of ((integer overflow)). It might not always work. The only thing NASM will guarantee is what's guaranteed by ANSI C: you always haveat least32 bits to work in.

NASM supports two special tokens in expressions, allowing calculations to involve the current assembly position: the$and$$tokens.$evaluates to the assembly position at the beginning of the line containing the expression; so you can code aninfinite loop usingJMP $.$$evaluates to the beginning of the current section; so you can tell how far into the section you are by using($-$$).

The arithmeticoperators provided by NASM are listed here, in increasing order ofprecedence.

3.6.1.|: Bitwise OR Operator

The|operator gives abitwise OR, exactly as performed by theORmachine instruction. Bitwise OR is the lowest-priority arithmetic operator supported by NASM.

3.6.2.^: Bitwise XOR Operator

^provides thebitwise XOR operation.

3.6.3.&: Bitwise AND Operator

&provides thebitwise AND operation.

3.6.4.<<and>>: Bit Shift Operators

<<gives a bit-shift to the left, just as it does in C. So5<<3evaluates to 5 times 8, or 40.>>gives a bit-shift to the right; in NASM, such a shift isalwaysunsigned, so that the bits shifted in from the left-hand end are filled with zero rather than a sign-extension of the previous highest bit.

3.6.5.+and-: Addition and Subtraction Operators

The+and-operators do perfectly ordinaryaddition andsubtraction.

3.6.6.*,/,//,%and%%: Multiplication and Division

*is themultiplication operator./and//are bothdivision operators:/isunsigned division and//issigned division. Similarly,%and%%provide unsigned and signedmodulo operators respectively.

NASM, like ANSI C, provides no guarantees about the sensible operation of the signed modulo operator.

Since the%character is used extensively by the macro preprocessor, you should ensure that both the signed and unsigned modulo operators are followed by white space wherever they appear.

3.6.7.Unary Operators:+,-,~andSEG

The highest-priority operators in NASM's expression grammar are those which only apply to one argument.-negates its operand,+does nothing (it's provided for symmetry with-),~computes theone's complement of its operand, andSEGprovides thesegment address of its operand (explained in more detail inSection3.6.8).

3.6.8.SEGandWRT

When writing large 16-bit programs, which must be split into multiplesegments, it is often necessary to be able to refer to the segment part of the address of a symbol. NASM supports theSEGoperator to perform this function.

TheSEGoperator returns thepreferredsegment base of a symbol, defined as the segment base relative to which the offset of the symbol makes sense. So the code

mov ax, seg symbol

mov es, ax

mov bx, symbol

will loades:bxwith a valid pointer to the symbolsymbol.

Things can be more complex than this: since 16-bit segments andgroups may overlap, you might occasionally want to refer to some symbol using a different segment base from the preferred one. NASM lets you do this, by the use of theWRT(With Reference To) keyword. So you can do things like

mov ax, weird_seg ; weird_seg is a segment base

mov es, ax

mov bx, symbol wrt weird_seg

to loades:bxwith a different, but functionally equivalent, pointer to the symbolsymbol.

NASM supports far (inter-segment) calls and jumps by means of the syntaxcall segment:offset, wheresegmentandoffsetboth represent immediate values. So to call a far procedure, you could code either of

call (seg procedure):procedure

call weird_seg:(procedure wrt weird_seg)

(The parentheses are included for clarity, to show the intended parsing of the above instructions. They are not necessary in practice.)

NASM supports the syntaxcall far procedureas a synonym for the first of the above usages.JMPworks identically toCALLin these examples.

To declare afar pointer to a data item in a data segment, you must code

dw symbol, seg symbol

NASM supports no convenient synonym for this, though you can always invent one using the macro processor.

3.7.STRICT: Inhibiting Optimization

When assembling with the optimizer set to level 2 or higher, NASM will use size specifiers (BYTE,WORD,DWORD,QWORD, orTWORD), but will give them the smallest possible size. The keywordSTRICTcan be used to inhibit optimization and force a particular operand to be emitted in the specified size. For example, with the optimizer on, and inBITS 16mode,

push dword 33

is encoded in three bytes66 6A 21, whereas

push strict dword 33

is encoded in six bytes, with a full dword immediate operand66 68 21 00 00 00.

3.8.Critical Expressions

A limitation of NASM is that it is atwo-pass assembler; unlike TASM and others, it will always do exactly twoassembly passes. Therefore it is unable to cope with source files that are complex enough to require three or morepasses.

The first pass is used to determine the size of all the assembled code and data, so that the second pass, when generating all the code, knows all the symbol addresses the code refers to. So one thing NASM can't handle is code whose size depends on the value of a symbol declared after the code in question. For example,

times (label-$) db 0

label: db 'Where am I?'

The argument toTIMESin this case could equally legally evaluate to anything at all; NASM will reject this example because it cannot tell the size of theTIMESline when it first sees it. It will just as firmly reject the slightlyparadoxical code

times (label-$+1) db 0

label: db 'NOW where am I?'

in whichanyvalue for theTIMESargument is by definition wrong!

NASM rejects these examples by means of a concept called acritical expression, which is defined to be an expression whose value is required to be computable in the first pass, and which must therefore depend only on symbols defined before it. The argument to theTIMESprefix is a critical expression; for the same reason, the arguments to theRESBfamily of pseudo-instructions are also critical expressions.

Critical expressions can crop up in other contexts as well: consider the following code.

mov ax, symbol1

symbol1 equ symbol2

symbol2:

On the first pass, NASM cannot determine the value ofsymbol1, becausesymbol1is defined to be equal tosymbol2which NASM hasn't seen yet. On the second pass, therefore, when it encounters the linemov ax,symbol1, it is unable to generate the code for it because it still doesn't know the value ofsymbol1. On the next line, it would see theEQUagain and be able to determine the value ofsymbol1, but by then it would be too late.

NASM avoids this problem by defining the right-hand side of anEQUstatement to be a critical expression, so the definition ofsymbol1would be rejected in the first pass.

There is a related issue involvingforward references: consider this code fragment.

mov eax, [ebx+offset]

offset equ 10

NASM, on pass one, must calculate the size of the instructionmov eax,[ebx+offset]without knowing the value ofoffset. It has no way of knowing thatoffsetis small enough to fit into a one-byte offset field and that it could therefore get away with generating a shorter form of theeffective-address encoding; for all it knows, in pass one,offsetcould be a symbol in the code segment, and it might need the full four-byte form. So it is forced to compute the size of the instruction to accommodate a four-byte address part. In pass two, having made this decision, it is now forced to honour it and keep the instruction large, so the code generated in this case is not as small as it could have been. This problem can be solved by definingoffsetbefore using it, or by forcing byte size in the effective address by coding[byte ebx+offset].

3.9.Local Labels

NASM gives special treatment to symbols beginning with aperiod. A label beginning with a single period is treated as alocallabel, which means that it is associated with the previous non-local label. So, for example:

label1 ; some code

.loop ; some more code

jne .loop

ret

label2 ; some code

.loop ; some more code

jne .loop

ret

In the above code fragment, eachJNEinstruction jumps to the line immediately before it, because the two definitions of.loopare kept separate by virtue of each being associated with the previous non-local label.

NASM goes one step further, in allowing access to local labels from other parts of the code. This is achieved by means ofdefininga local label in terms of the previous non-local label: the first definition of.loopabove is really defining a symbol calledlabel1.loop, and the second defines a symbol calledlabel2.loop. So, if you really needed to, you could write

label3 ; some more code

; and some more

jmp label1.loop

Sometimes it is useful - in a macro, for instance - to be able to define a label which can be referenced from anywhere but which doesn't interfere with the normal local-label mechanism. Such a label can't be non-local because it would interfere with subsequent definitions of, and references to, local labels; and it can't be local because the macro that defined it wouldn't know the label's full name. NASM therefore introduces a third type of label, which is probably only useful in macro definitions: if a label begins with the special prefix..@, then it does nothing to the local label mechanism. So you could code

label1: ; a non-local label

.local: ; this is really label1.local

..@foo: ; this is a special symbol

label2: ; another non-local label

.local: ; this is really label2.local

jmp ..@foo ; this will jump three lines up

NASM has the capacity to define other special symbols beginning with a double period: for example,..startis used to specify the entry point in theobjoutput format.

Chapter4.The NASM Preprocessor

Table of Contents

4.1. Single-Line Macros

4.1.1. The Normal Way:%define

4.1.2. Enhancing %define:%xdefine

4.1.3. Concatenating Single Line Macro Tokens:%+

4.1.4. Undefining macros:%undef

4.1.5. Preprocessor Variables:%assign

4.2. String Handling in Macros

4.2.1. String Length:%strlen

4.2.2. Sub-strings:%substr

4.3. Multi-Line Macros

4.3.1. Overloading Multi-Line Macros

4.3.2. Macro-Local Labels

4.3.3. Greedy Macro Parameters

4.3.4. Default Macro Parameters

4.3.5.%0: Macro Parameter Counter

4.3.6.%rotate: Rotating Macro Parameters

4.3.7. Concatenating Macro Parameters

4.3.8. Condition Codes as Macro Parameters

4.3.9. Disabling Listing Expansion

4.4. Conditional Assembly

4.4.1.%ifdef: Testing Single-Line Macro Existence

4.4.2.%ifmacro: Testing Multi-Line Macro Existence

4.4.3.%ifctx: Testing the Context Stack

4.4.4.%if: Testing Arbitrary Numeric Expressions

4.4.5.%ifidnand%ifidni: Testing Exact Text Identity

4.4.6.%ifid,%ifnum,%ifstr: Testing Token Types

4.4.7.%error: Reporting User-Defined Errors

4.5. Preprocessor Loops

4.6. Including Other Files

4.7. The Context Stack

4.7.1.%pushand%pop: Creating and Removing Contexts

4.7.2. Context-Local Labels

4.7.3. Context-Local Single-Line Macros

4.7.4.%repl: Renaming a Context

4.7.5. Example Use of the Context Stack: Block IFs

4.8. Standard Macros

4.8.1.__YASM_MAJOR__, etc: Yasm Version

4.8.2.__FILE__and__LINE__: File Name and Line Number

4.8.3.__YASM_OBJFMT__and__OUTPUT_FORMAT__: Output Object Format Keyword

4.8.4.STRUCandENDSTRUC: Declaring Structure Data Types

4.8.5.ISTRUC,ATandIEND: Declaring Instances of Structures

4.8.6.ALIGNandALIGNB: Data Alignment

NASM contains a powerfulmacro processor, which supports conditional assembly, multi-level file inclusion, two forms of macro (single-line and multi-line), and a"context stack"mechanism for extra macro power. Preprocessor directives all begin with a%sign.

The preprocessor collapses all lines which end with a backslash () character into a single line. Thus:

%define THIS_VERY_LONG_MACRO_NAME_IS_DEFINED_TO

THIS_VALUE

will work like a single-line macro without the backslash-newline sequence.

4.1.Single-Line Macros

4.1.1.The Normal Way:%define

Single-line macros are defined using the%definepreprocessor directive. The definitions work in a similar way to C; so you can do things like

%define ctrl 0x1F &

%define param(a,b) ((a)+(a)*(b))


mov byte [param(2,ebx)], ctrl 'D'

which will expand to

mov byte [(2)+(2)*(ebx)], 0x1F & 'D'

When the expansion of a single-line macro contains tokens which invoke another macro, the expansion is performed at invocation time, not at definition time. Thus the code

%define a(x) 1+b(x)

%define b(x) 2*x


mov ax,a(8)

will evaluate in the expected way tomov ax,1+2*8, even though the macrobwasn't defined at the time of definition ofa.

Macros defined with%definearecase sensitive: after%define foo bar, onlyfoowill expand tobar:FooorFOOwill not. By using%idefineinstead of%define(the"i"stands for"insensitive") you can define all the case variants of a macro at once, so that%idefine foo barwould causefoo,Foo,FOO,fOOand so on all to expand tobar.

There is a mechanism which detects when a macro call has occurred as a result of a previous expansion of the same macro, to guard againstcircular references and infinite loops. If this happens, the preprocessor will only expand the first occurrence of the macro. Hence, if you code

%define a(x) 1+a(x)


mov ax,a(3)

the macroa(3)will expand once, becoming1+a(3), and will then expand no further. This behaviour can be useful.

You can overload single-line macros: if you write

%define foo(x) 1+x

%define foo(x,y) 1+x*y

the preprocessor will be able to handle both types of macro call, by counting the parameters you pass; sofoo(3)will become1+3whereasfoo(ebx,2)will become1+ebx*2. However, if you define

%define foo bar

then no other definition offoowill be accepted: a macro with no parameters prohibits the definition of the same name as a macrowithparameters, and vice versa.

This doesn't prevent single-line macros beingredefined: you can perfectly well define a macro with

%define foo bar

and then re-define it later in the same source file with

%define foo baz

Then everywhere the macrofoois invoked, it will be expanded according to the most recent definition. This is particularly useful when defining single-line macros with%assign(seeSection4.1.5).

You canpre-define single-line macros using the"-D"option on the Yasm command line: seeSection1.3.3.1.

4.1.2.Enhancing %define:%xdefine

To have a reference to an embedded single-line macro resolved at the time that it is embedded, as opposed to when the calling macro is expanded, you need a different mechanism to the one offered by%define. The solution is to use%xdefine, or its case-insensitive counterpart%xidefine.

Suppose you have the following code:

%define isTrue 1

%define isFalse isTrue

%define isTrue 0


val1: db isFalse


%define isTrue 1


val2: db isFalse

In this case,val1is equal to 0, andval2is equal to 1. This is because, when a single-line macro is defined using%define, it is expanded only when it is called. AsisFalseexpands toisTrue, the expansion will be the current value ofisTrue. The first time it is called that is 0, and the second time it is 1.

If you wantedisFalseto expand to the value assigned to the embedded macroisTrueat the time thatisFalsewas defined, you need to change the above code to use%xdefine.

%xdefine isTrue 1

%xdefine isFalse isTrue

%xdefine isTrue 0


val1: db isFalse


%xdefine isTrue 1


val2: db isFalse

Now, each time thatisFalseis called, it expands to 1, as that is what the embedded macroisTrueexpanded to at the time thatisFalsewas defined.

4.1.3.Concatenating Single Line Macro Tokens:%+

Individual tokens in single line macros can be concatenated, to produce longer tokens for later processing. This can be useful if there are several similar macros that perform similar functions.

As an example, consider the following:

%define BDASTART 400h ; Start of BIOS data area


struc tBIOSDA ; its structure

.COM1addr RESW 1

.COM2addr RESW 1

; ..and so on

endstruc

Now, if we need to access the elements of tBIOSDA in different places, we can end up with:

mov ax,BDASTART + tBIOSDA.COM1addr

mov bx,BDASTART + tBIOSDA.COM2addr

This will become pretty ugly (and tedious) if used in many places, and can be reduced in size significantly by using the following macro:

; Macro to access BIOS variables by their names (from tBDA):


%define BDA(x) BDASTART + tBIOSDA. %+ x

Now the above code can be written as:

mov ax,BDA(COM1addr)

mov bx,BDA(COM2addr)

Using this feature, we can simplify references to a lot of macros (and, in turn, reduce typing errors).

4.1.4.Undefining macros:%undef

Single-line macros can be removed with the%undefcommand. For example, the following sequence:

%define foo bar

%undef foo


mov eax, foo

will expand to the instructionmov eax, foo, since after%undefthe macrofoois no longer defined.

Macros that would otherwise be pre-defined can be undefined on the command-line using the"-U"option on the Yasm command line: seeSection1.3.3.5.

4.1.5.Preprocessor Variables:%assign

An alternative way to define single-line macros is by means of the%assigncommand (and its case-insensitive counterpart%iassign, which differs from%assignin exactly the same way that%idefinediffers from%define).

%assignis used to define single-line macros which take no parameters and have a numeric value. This value can be specified in the form of an expression, and it will be evaluated once, when the%assigndirective is processed.

Like%define, macros defined using%assigncan be re-defined later, so you can do things like

%assign i i+1

to increment the numeric value of a macro.

%assignis useful for controlling the termination of%reppreprocessor loops: seeSection4.5for an example of this.

The expression passed to%assignis acritical expression (seeSection3.8), and must also evaluate to a pure number (rather than a relocatable reference such as a code or data address, or anything involving a register).

4.2.String Handling in Macros

It's often useful to be able to handle strings in macros. NASM supports two simple string handling macro operators from which more complex operations can be constructed.

4.2.1.String Length:%strlen

The%strlenmacro is like%assignmacro in that it creates (or redefines) a numeric value to a macro. The difference is that with%strlen, the numeric value is the length of a string. An example of the use of this would be:

%strlen charcnt 'my string'

In this example,charcntwould receive the value 8, just as if an%assignhad been used. In this example,'my string'was a literal string but it could also have been a single-line macro that expands to a string, as in the following example:

%define sometext 'my string'

%strlen charcnt sometext

As in the first case, this would result incharcntbeing assigned the value of 8.

4.2.2.Sub-strings:%substr

Individual letters in strings can be extracted using%substr. An example of its use is probably more useful than the description:

%substr mychar 'xyz' 1 ; equivalent to %define mychar 'x'

%substr mychar 'xyz' 2 ; equivalent to %define mychar 'y'

%substr mychar 'xyz' 3 ; equivalent to %define mychar 'z'

In this example, mychar gets the value of'y'. As with%strlen(seeSection4.2.1), the first parameter is the single-line macro to be created and the second is the string. The third parameter specifies which character is to be selected. Note that the first index is 1, not 0 and the last index is equal to the value that%strlenwould assign given the same string. Index values out of range result in an empty string.

4.3.Multi-Line Macros

Multi-line macros are much more like the type of macro seen in MASM and TASM: a multi-line macro definition in NASM looks something like this.

%macro prologue 1


push ebp

mov ebp,esp

sub esp,%1


%endmacro

This defines a C-like function prologue as a macro: so you would invoke the macro with a call such as

myfunc: prologue 12

which would expand to the three lines of code

myfunc: push ebp

mov ebp,esp

sub esp,12

The number1after the macro name in the%macroline defines the number of parameters the macroprologueexpects to receive. The use of%1inside the macro definition refers to the first parameter to the macro call. With a macro taking more than one parameter, subsequent parameters would be referred to as%2,%3and so on.

Multi-line macros, like single-line macros, arecase-sensitive, unless you define them using the alternative directive%imacro.

If you need to pass a comma aspartof a parameter to a multi-line macro, you can do that by enclosing the entire parameter in braces. So you could code things like

%macro silly 2


%2: db %1


%endmacro


silly 'a', letter_a ; letter_a: db 'a'

silly 'ab', string_ab ; string_ab: db 'ab'

silly {13,10}, crlf ; crlf: db 13,10

4.3.1.Overloading Multi-Line Macros

As with single-line macros, multi-line macros can be overloaded by defining the same macro name several times with different numbers of parameters. This time, no exception is made for macros with no parameters at all. So you could define

%macro prologue 0


push ebp

mov ebp,esp


%endmacro

to define an alternative form of the function prologue which allocates no local stack space.

Sometimes, however, you might want to"overload"a machine instruction; for example, you might want to define

%macro push 2


push %1

push %2


%endmacro

so that you could code

push ebx ; this line is not a macro call

push eax,ecx ; but this one is

Ordinarily, NASM will give a warning for the first of the above two lines, sincepushis now defined to be a macro, and is being invoked with a number of parameters for which no definition has been given. The correct code will still be generated, but the assembler will give a warning. This warning can be disabled by the use of the-wno-macro-paramscommand-line option (seeSection1.3.2).

4.3.2.Macro-Local Labels

NASM allows you to define labels within a multi-line macro definition in such a way as to make them local to the macro call: so calling the same macro multiple times will use a different label each time. You do this by prefixing%%to the label name. So you can invent an instruction which executes aRETif theZflag is set by doing this:

%macro retz 0


jnz %%skip

ret

%%skip:


%endmacro

You can call this macro as many times as you want, and every time you call it NASM will make up a different"real"name to substitute for the label%%skip. The names NASM invents are of the form..@2345.skip, where the number 2345 changes with every macro call. The..@prefix prevents macro-local labels from interfering with the local label mechanism, as described inSection3.9. You should avoid defining your own labels in this form (the..@prefix, then a number, then another period) in case they interfere with macro-local labels.

4.3.3.Greedy Macro Parameters

Occasionally it is useful to define a macro which lumps its entire command line into one parameter definition, possibly after extracting one or two smaller parameters from the front. An example might be a macro to write a text string to a file in MS-DOS, where you might want to be able to write

writefile [filehandle],"hello, world",13,10

NASM allows you to define the last parameter of a macro to begreedy, meaning that if you invoke the macro with more parameters than it expects, all the spare parameters get lumped into the last defined one along with the separating commas. So if you code:

%macro writefile 2+


jmp %%endstr

%%str: db %2

%%endstr:

mov dx,%%str

mov cx,%%endstr-%%str

mov bx,%1

mov ah,0x40

int 0x21


%endmacro

then the example call towritefileabove will work as expected: the text before the first comma,[filehandle], is used as the first macro parameter and expanded when%1is referred to, and all the subsequent text is lumped into%2and placed after thedb.

The greedy nature of the macro is indicated to NASM by the use of the+sign after the parameter count on the%macroline.

If you define a greedy macro, you are effectively telling NASM how it should expand the macro givenanynumber of parameters from the actual number specified up to infinity; in this case, for example, NASM now knows what to do when it sees a call towritefilewith 2, 3, 4 or more parameters. NASM will take this into account when overloading macros, and will not allow you to define another form ofwritefiletaking 4 parameters (for example).

Of course, the above macro could have been implemented as a non-greedy macro, in which case the call to it would have had to look like

writefile [filehandle], {"hello, world",13,10}

NASM provides both mechanisms for putting ((commas in macro parameters)), and you choose which one you prefer for each macro definition.

SeeSection5.3.3for a better way to write the above macro.

4.3.4.Default Macro Parameters

NASM also allows you to define a multi-line macro with arangeof allowable parameter counts. If you do this, you can specify defaults foromitted parameters. So, for example:

%macro die 0-1 "Painful program death has occurred."


writefile 2,%1

mov ax,0x4c01

int 0x21


%endmacro

This macro (which makes use of thewritefilemacro defined inSection4.3.3) can be called with an explicit error message, which it will display on the error output stream before exiting, or it can be called with no parameters, in which case it will use the default error message supplied in the macro definition.

In general, you supply a minimum and maximum number of parameters for a macro of this type; the minimum number of parameters are then required in the macro call, and then you provide defaults for the optional ones. So if a macro definition began with the line

%macro foobar 1-3 eax,[ebx+2]

then it could be called with between one and three parameters, and%1would always be taken from the macro call.%2, if not specified by the macro call, would default toeax, and%3if not specified would default to[ebx+2].

You may omit parameter defaults from the macro definition, in which case the parameter default is taken to be blank. This can be useful for macros which can take a variable number of parameters, since the%0token (seeSection4.3.5) allows you to determine how many parameters were really passed to the macro call.

This defaulting mechanism can be combined with the greedy-parameter mechanism; so thediemacro above could be made more powerful, and more useful, by changing the first line of the definition to

%macro die 0-1+ "Painful program death has occurred.",13,10

The maximum parameter count can be infinite, denoted by*. In this case, of course, it is impossible to provide afullset of default parameters. Examples of this usage are shown inSection4.3.6.

4.3.5.%0: Macro Parameter Counter

For a macro which can take a variable number of parameters, the parameter reference%0will return a numeric constant giving the number of parameters passed to the macro. This can be used as an argument to%rep(seeSection4.5) in order to iterate through all the parameters of a macro. Examples are given inSection4.3.6.

4.3.6.%rotate: Rotating Macro Parameters

Unix shell programmers will be familiar with theshiftshell command, which allows the arguments passed to a shell script (referenced as$1,$2and so on) to be moved left by one place, so that the argument previously referenced as$2becomes available as$1, and the argument previously referenced as$1is no longer available at all.

NASM provides a similar mechanism, in the form of%rotate. As its name suggests, it differs from the Unixshiftin that no parameters are lost: parameters rotated off the left end of the argument list reappear on the right, and vice versa.

%rotateis invoked with a single numeric argument (which may be an expression). The macro parameters are rotated to the left by that many places. If the argument to%rotateis negative, the macro parameters are rotated to the right.

So a pair of macros to save and restore a set of registers might work as follows:

%macro multipush 1-*


%rep %0

push %1

%rotate 1

%endrep


%endmacro

This macro invokes thePUSHinstruction on each of its arguments in turn, from left to right. It begins by pushing its first argument,%1, then invokes%rotateto move all the arguments one place to the left, so that the original second argument is now available as%1. Repeating this procedure as many times as there were arguments (achieved by supplying%0as the argument to%rep) causes each argument in turn to be pushed.

Note also the use of*as the maximum parameter count, indicating that there is no upper limit on the number of parameters you may supply to themultipushmacro.

It would be convenient, when using this macro, to have aPOPequivalent, whichdidn'trequire the arguments to be given in reverse order. Ideally, you would write themultipushmacro call, then cut-and-paste the line to where the pop needed to be done, and change the name of the called macro tomultipop, and the macro would take care of popping the registers in the opposite order from the one in which they were pushed.

This can be done by the following definition:

%macro multipop 1-*


%rep %0

%rotate -1

pop %1

%endrep


%endmacro

This macro begins by rotating its arguments one place to theright, so that the originallastargument appears as%1. This is then popped, and the arguments are rotated right again, so the second-to-last argument becomes%1. Thus the arguments are iterated through in reverse order.

4.3.7.Concatenating Macro Parameters

NASM can concatenate macro parameters on to other text surrounding them. This allows you to declare a family of symbols, for example, in a macro definition. If, for example, you wanted to generate a table of key codes along with offsets into the table, you could code something like

%macro keytab_entry 2


keypos%1 equ $-keytab

db %2


%endmacro


keytab:

keytab_entry F1,128+1

keytab_entry F2,128+2

keytab_entry Return,13

which would expand to

keytab:

keyposF1 equ $-keytab

db 128+1

keyposF2 equ $-keytab

db 128+2

keyposReturn equ $-keytab

db 13

You can just as easily concatenate text on to the other end of a macro parameter, by writing%1foo.

If you need to append adigitto a macro parameter, for example defining labelsfoo1andfoo2when passed the parameterfoo, you can't code%11because that would be taken as the eleventh macro parameter. Instead, you must code%{1}1, which will separate the first1(giving the number of the macro parameter) from the second (literal text to be concatenated to the parameter).

This concatenation can also be applied to other preprocessor in-line objects, such as macro-local labels (Section4.3.2) and context-local labels (Section4.7.2). In all cases, ambiguities in syntax can be resolved by enclosing everything after the%sign and before the literal text in braces: so%{%foo}barconcatenates the textbarto the end of the real name of the macro-local label%%foo. (This is unnecessary, since the form NASM uses for the real names of macro-local labels means that the two usages%{%foo}barand%%foobarwould both expand to the same thing anyway; nevertheless, the capability is there.)

4.3.8.Condition Codes as Macro Parameters

NASM can give special treatment to a macro parameter which contains a condition code. For a start, you can refer to the macro parameter%1by means of the alternative syntax%+1, which informs NASM that this macro parameter is supposed to contain a condition code, and will cause the preprocessor to report an error message if the macro is called with a parameter which isnota valid condition code.

Far more usefully, though, you can refer to the macro parameter by means of%-1, which NASM will expand as theinversecondition code. So theretzmacro defined inSection4.3.2can be replaced by a generalconditional-return macro like this:

%macro retc 1


j%-1 %%skip

ret

%%skip:


%endmacro

This macro can now be invoked using calls likeretc ne, which will cause the conditional-jump instruction in the macro expansion to come out asJE, orretc powhich will make the jump aJPE.

The%+1macro-parameter reference is quite happy to interpret the argumentsCXZandECXZas valid condition codes; however,%-1will report an error if passed either of these, because no inverse condition code exists.

4.3.9.Disabling Listing Expansion

When NASM is generating a listing file from your program, it will generally expand multi-line macros by means of writing the macro call and then listing each line of the expansion. This allows you to see which instructions in the macro expansion are generating what code; however, for some macros this clutters the listing up unnecessarily.

NASM therefore provides the.nolistqualifier, which you can include in a macro definition to inhibit the expansion of the macro in the listing file. The.nolistqualifier comes directly after the number of parameters, like this:

%macro foo 1.nolist

Or like this:

%macro bar 1-5+.nolist a,b,c,d,e,f,g,h

4.4.Conditional Assembly

Similarly to the C preprocessor, NASM allows sections of a source file to be assembled only if certain conditions are met. The general syntax of this feature looks like this:

%if<condition>

; some code which only appears if <condition> is met

%elif<condition2>

; only appears if <condition> is not met but <condition2> is

%else

; this appears if neither <condition> nor <condition2> was met

%endif

The%elseclause is optional, as is the%elifclause. You can have more than one%elifclause as well.

4.4.1.%ifdef: Testing Single-Line Macro Existence

Beginning a conditional-assembly block with the line%ifdef MACROwill assemble the subsequent code if, and only if, a single-line macro calledMACROis defined. If not, then the%elifand%elseblocks (if any) will be processed instead.

For example, when debugging a program, you might want to write code such as

; perform some function

%ifdef DEBUG

writefile 2,"Function performed successfully",13,10

%endif

; go and do something else

Then you could use the command-line option-D DEBUGto create a version of the program which produced debugging messages, and remove the option to generate the final release version of the program.

You can test for a macronotbeing defined by using%ifndefinstead of%ifdef. You can also test for macro definitions in%elifblocks by using%elifdefand%elifndef.

4.4.2.%ifmacro: Testing Multi-Line Macro Existence

The%ifmacrodirective operates in the same way as the%ifdefdirective, except that it checks for the existence of a multi-line macro.

For example, you may be working with a large project and not have control over the macros in a library. You may want to create a macro with one name if it doesn't already exist, and another name if one with that name does exist.

The%ifmacrois considered true if defining a macro with the given name and number of arguments would cause a definitions conflict. For example:

%ifmacro MyMacro 1-3


%error "MyMacro 1-3" causes a conflict with an existing macro.


%else


%macro MyMacro 1-3


; insert code to define the macro


%endmacro


%endif

This will create the macroMyMacro 1-3if no macro already exists which would conflict with it, and emits a warning if there would be a definition conflict.

You can test for the macro not existing by using the%ifnmacroinstead of%ifmacro. Additional tests can be performed in%elifblocks by using%elifmacroand%elifnmacro.

4.4.3.%ifctx: Testing the Context Stack

The conditional-assembly construct%ifctx ctxnamewill cause the subsequent code to be assembled if and only if the top context on the preprocessor's context stack has the namectxname. As with%ifdef, the inverse and%elifforms%ifnctx,%elifctxand%elifnctxare also supported.

For more details of the context stack, seeSection4.7. For a sample use of%ifctx, seeSection4.7.5.

4.4.4.%if: Testing Arbitrary Numeric Expressions

The conditional-assembly construct%if exprwill cause the subsequent code to be assembled if and only if the value of the numeric expressionexpris non-zero. An example of the use of this feature is in deciding when to break out of a%reppreprocessor loop: seeSection4.5for a detailed example.

The expression given to%if, and its counterpart%elif, is a critical expression (seeSection3.8).

%ifextends the normal NASM expression syntax, by providing a set ofrelational operators which are not normally available in expressions. The operators=,<,>,<=,>=and<>test equality, less-than, greater-than, less-or-equal, greater-or-equal and not-equal respectively. The C-like forms==and!=are supported as alternative forms of=and<>. In addition, low-priority logical operators&&,^^and||are provided, supplyinglogical AND,logical XOR andlogical OR. These work like the C logical operators (although C has no logical XOR), in that they always return either 0 or 1, and treat any non-zero input as 1 (so that^^, for example, returns 1 if exactly one of its inputs is zero, and 0 otherwise). The relational operators also return 1 for true and 0 for false.

4.4.5.%ifidnand%ifidni: Testing Exact Text Identity

The construct%ifidn text1,text2will cause the subsequent code to be assembled if and only iftext1andtext2, after expanding single-line macros, are identical pieces of text. Differences in white space are not counted.

%ifidniis similar to%ifidn, but iscase-insensitive.

For example, the following macro pushes a register or number on the stack, and allows you to treatIPas a real register:

%macro pushparam 1


%ifidni %1,ip

call %%label

%%label:

%else

push %1

%endif


%endmacro

Like most other%ifconstructs,%ifidnhas a counterpart%elifidn, and negative forms%ifnidnand%elifnidn. Similarly,%ifidnihas counterparts%elifidni,%ifnidniand%elifnidni.

4.4.6.%ifid,%ifnum,%ifstr: Testing Token Types

Some macros will want to perform different tasks depending on whether they are passed a number, a string, or an identifier. For example, a string output macro might want to be able to cope with being passed either a string constant or a pointer to an existing string.

The conditional assembly construct%ifid, taking one parameter (which may be blank), assembles the subsequent code if and only if the first token in the parameter exists and is an identifier.%ifnumworks similarly, but tests for the token being a numeric constant;%ifstrtests for it being a string.

For example, thewritefilemacro defined inSection4.3.3can be extended to take advantage of%ifstrin the following fashion:

%macro writefile 2-3+

%ifstr %2

jmp %%endstr

%if %0 = 3

%%str: db %2,%3

%else

%%str: db %2

%endif

%%endstr: mov dx,%%str

mov cx,%%endstr-%%str

%else

mov dx,%2

mov cx,%3

%endif

mov bx,%1

mov ah,0x40

int 0x21

%endmacro

Then thewritefilemacro can cope with being called in either of the following two ways:

writefile [file], strpointer, length

writefile [file], "hello", 13, 10

In the first,strpointeris used as the address of an already-declared string, andlengthis used as its length; in the second, a string is given to the macro, which therefore declares it itself and works out the address and length for itself.

Note the use of%ifinside the%ifstr: this is to detect whether the macro was passed two arguments (so the string would be a single string constant, anddb %2would be adequate) or more (in which case, all but the first two would be lumped together into%3, anddb %2,%3would be required).

The usual%elifXXX,%ifnXXXand%elifnXXXversions exist for each of%ifid,%ifnumand%ifstr.

4.4.7.%error: Reporting User-Defined Errors

The preprocessor directive%errorwill cause NASM to report an error if it occurs in assembled code. So if other users are going to try to assemble your source files, you can ensure that they define the right macros by means of code like this:

%ifdef SOME_MACRO

; do some setup

%elifdef SOME_OTHER_MACRO

; do some different setup

%else

%error Neither SOME_MACRO nor SOME_OTHER_MACRO was defined.

%endif

Then any user who fails to understand the way your code is supposed to be assembled will be quickly warned of their mistake, rather than having to wait until the program crashes on being run and then not knowing what went wrong.

4.5.Preprocessor Loops

NASM'sTIMESprefix, though useful, cannot be used to invoke a multi-line macro multiple times, because it is processed by NASM after macros have already been expanded. Therefore NASM provides another form of loop, this time at the preprocessor level:%rep.

The directives%repand%endrep(%reptakes a numeric argument, which can be an expression;%endreptakes no arguments) can be used to enclose a chunk of code, which is then replicated as many times as specified by the preprocessor:

%assign i 0

%rep 64

inc word


%assign i i+1

%endrep

This will generate a sequence of 64INCinstructions, incrementing every word of memory from

to
.

For more complex termination conditions, or to break out of a repeat loop part way along, you can use the%exitrepdirective to terminate the loop, like this:

fibonacci:

%assign i 0

%assign j 1

%rep 100

%if j > 65535

%exitrep

%endif

dw j

%assign k j+i

%assign i j

%assign j k

%endrep


fib_number equ ($-fibonacci)/2

This produces a list of all the Fibonacci numbers that will fit in 16 bits. Note that a maximum repeat count must still be given to%rep. This is to prevent the possibility of NASM getting into an infinite loop in the preprocessor, which (on multitasking or multi-user systems) would typically cause all the system memory to be gradually used up and other applications to start crashing.

4.6.Including Other Files

Using, once again, a very similar syntax to the C preprocessor, the NASM preprocessor lets you include other source files into your code. This is done by the use of the%includedirective:

%include "macros.mac"

will include the contents of the filemacros.macinto the source file containing the%includedirective.

Include files are first searched for relative to the directory containing the source file that is performing the inclusion, and then relative to any directories specified on the Yasm command line using the-Ioption (seeSection1.3.3.3), in the order given on the command line (any relative paths on the Yasm command line are relative to the current working directory, e.g. where Yasm is being run from). While this search strategy does not match traditional NASM behavior, it does match the behavior of most C compilers and better handles relative pathnames.

The standard C idiom for preventing a file being included more than once is just as applicable in the NASM preprocessor: if the filemacros.machas the form

%ifndef MACROS_MAC

%define MACROS_MAC

; now define some macros

%endif

then including the file more than once will not cause errors, because the second time the file is included nothing will happen because the macroMACROS_MACwill already be defined.

You can force a file to be included even if there is no%includedirective that explicitly includes it, by using the-Poption on the Yasm command line (seeSection1.3.3.4).

4.7.The Context Stack

Having labels that are local to a macro definition is sometimes not quite powerful enough: sometimes you want to be able to share labels between several macro calls. An example might be aREPEAT…UNTILloop, in which the expansion of theREPEATmacro would need to be able to refer to a label which theUNTILmacro had defined. However, for such a macro you would also want to be able to nest these loops.

The NASM preprocessor provides this level of power by means of acontext stack. The preprocessor maintains a stack ofcontexts, each of which is characterised by a name. You add a new context to the stack using the%pushdirective, and remove one using%pop. You can define labels that are local to a particular context on the stack.

4.7.1.%pushand%pop: Creating and Removing Contexts

The%pushdirective is used to create a new context and place it on the top of the context stack.%pushrequires one argument, which is the name of the context. For example:

%push foobar

This pushes a new context calledfoobaron the stack. You can have several contexts on the stack with the same name: they can still be distinguished.

The directive%pop, requiring no arguments, removes the top context from the context stack and destroys it, along with any labels associated with it.

4.7.2.Context-Local Labels

Just as the usage%%foodefines a label which is local to the particular macro call in which it is used, the usage%$foois used to define a label which is local to the context on the top of the context stack. So theREPEATandUNTILexample given above could be implemented by means of:

%macro repeat 0


%push repeat

%$begin:


%endmacro


%macro until 1


j%-1 %$begin

%pop


%endmacro

and invoked by means of, for example,

mov cx,string

repeat

add cx,3

scasb

until e

which would scan every fourth byte of a string in search of the byte inAL.

If you need to define, or access, labels local to the contextbelowthe top one on the stack, you can use%$$foo, or%$$$foofor the context below that, and so on.

4.7.3.Context-Local Single-Line Macros

The NASM preprocessor also allows you to define single-line macros which are local to a particular context, in just the same way:

%define %$localmac 3

will define the single-line macro%$localmacto be local to the top context on the stack. Of course, after a subsequent%push, it can then still be accessed by the name%$$localmac.

4.7.4.%repl: Renaming a Context

If you need to change the name of the top context on the stack (in order, for example, to have it respond differently to%ifctx), you can execute a%popfollowed by a%push; but this will have the side effect of destroying all context-local labels and macros associated with the context that was just popped.

The NASM preprocessor provides the directive%repl, whichreplacesa context with a different name, without touching the associated macros and labels. So you could replace the destructive code

%pop

%push newname

with the non-destructive version%repl newname.

4.7.5.Example Use of the Context Stack: Block IFs

This example makes use of almost all the context-stack features, including the conditional-assembly construct%ifctx, to implement a block IF statement as a set of macros.

%macro if 1


%push if

j%-1 %$ifnot


%endmacro


%macro else 0


%ifctx if

%repl else

jmp %$ifend

%$ifnot:

%else

%error "expected `if' before `else'"

%endif


%endmacro


%macro endif 0


%ifctx if

%$ifnot:

%pop

%elifctx else

%$ifend:

%pop

%else

%error "expected `if' or `else' before `endif'"

%endif


%endmacro

This code is more robust than theREPEATandUNTILmacros given inSection4.7.2, because it uses conditional assembly to check that the macros are issued in the right order (for example, not callingendifbeforeif) and issues a%errorif they're not.

In addition, theendifmacro has to be able to cope with the two distinct cases of either directly following anif, or following anelse. It achieves this, again, by using conditional assembly to do different things depending on whether the context on top of the stack isiforelse.

Theelsemacro has to preserve the context on the stack, in order to have the%$ifnotreferred to by theifmacro be the same as the one defined by theendifmacro, but has to change the context's name so thatendifwill know there was an interveningelse. It does this by the use of%repl.

A sample usage of these macros might look like:

cmp ax,bx

if ae

cmp bx,cx

if ae

mov ax,cx

else

mov ax,bx

endif

else

cmp ax,cx

if ae

mov ax,cx

endif

endif

The block-IFmacros handle nesting quite happily, by means of pushing another context, describing the innerif, on top of the one describing the outerif; thuselseandendifalways refer to the last unmatchediforelse.

4.8.Standard Macros

Yasm defines a set of standard macros in the NASM preprocessor which are already defined when it starts to process any source file. If you really need a program to be assembled with no pre-defined macros, you can use the%cleardirective to empty the preprocessor of everything.

Most user-level NASM syntax directives (seeChapter5) are implemented as macros which invoke primitive directives; these are described inChapter5. The rest of the standard macro set is described here.

4.8.1.__YASM_MAJOR__, etc: Yasm Version

The single-line macros__YASM_MAJOR__,__YASM_MINOR__, and__YASM_SUBMINOR__expand to the major, minor, and subminor parts of theversion number of Yasm being used. In addition,__YASM_VER__expands to a string representation of the Yasm version and__YASM_VERSION_ID__expands to a 32-bit BCD-encoded representation of the Yasm version, with the major version in the most significant 8 bits, followed by the 8-bit minor version and 8-bit subminor version, and 0 in the least significant 8 bits. For example, under Yasm 0.5.1,__YASM_MAJOR__would be defined to be 0,__YASM_MINOR__would be defined as 5,__YASM_SUBMINOR__would be defined as 1,__YASM_VER__would be defined as"0.5.1", and__YASM_VERSION_ID__would be defined as000050100h.

In addition, the single line macro__YASM_BUILD__expands to the Yasm"build"number, typically the Subversion changeset number. It should be seen as less significant than the subminor version, and is generally only useful in discriminating between Yasm nightly snapshots or pre-release (e.g. release candidate) Yasm versions.

4.8.2.__FILE__and__LINE__: File Name and Line Number

Like the C preprocessor, the NASM preprocessor allows the user to find out the file name and line number containing the current instruction. The macro__FILE__expands to a string constant giving the name of the current input file (which may change through the course of assembly if%includedirectives are used), and__LINE__expands to a numeric constant giving the current line number in the input file.

These macros could be used, for example, to communicate debugging information to a macro, since invoking__LINE__inside a macro definition (either single-line or multi-line) will return the line number of the macrocall, rather thandefinition. So to determine where in a piece of code a crash is occurring, for example, one could write a routinestillhere, which is passed a line number inEAXand outputs something like"line 155: still here". You could then write a macro

%macro notdeadyet 0

push eax

mov eax, __LINE__

call stillhere

pop eax

%endmacro

and then pepper your code with calls tonotdeadyetuntil you find the crash point.

4.8.3.__YASM_OBJFMT__and__OUTPUT_FORMAT__: Output Object Format Keyword

__YASM_OBJFMT__, and its NASM-compatible alias__OUTPUT_FORMAT__, expand to the object formatkeywordspecified on the command line with-fkeyword(seeSection1.3.1.2). For example, ifyasmis invoked with-f elf,__YASM_OBJFMT__expands toelf.

These expansions match the option given on the command line exactly, even when the object formats are equivalent. For example,-f elfand-f elf32are equivalent specifiers for the 32-bit ELF format, and-f elf -m amd64and-f elf64are equivalent specifiers for the 64-bit ELF format, but__YASM_OBJFMT__would expand toelfandelf32for the first two cases, andelfandelf64for the second two cases.

4.8.4.STRUCandENDSTRUC: Declaring Structure Data Types

The NASM preprocessor is sufficiently powerful that data structures can be implemented as a set of macros. The macrosSTRUCandENDSTRUCare used to define a structure data type.

STRUCtakes one parameter, which is the name of the data type. This name is defined as a symbol with the value zero, and also has the suffix_sizeappended to it and is then defined as anEQUgiving the size of the structure. OnceSTRUChas been issued, you are defining the structure, and should define fields using theRESBfamily of pseudo-instructions, and then invokeENDSTRUCto finish the definition.

For example, to define a structure calledmytypecontaining a longword, a word, a byte and a string of bytes, you might code

struc mytype

mt_long: resd 1

mt_word: resw 1

mt_byte: resb 1

mt_str: resb 32

endstruc

The above code defines six symbols:mt_longas 0 (the offset from the beginning of amytypestructure to the longword field),mt_wordas 4,mt_byteas 6,mt_stras 7,mytype_sizeas 39, andmytypeitself as zero.

The reason why the structure type name is defined at zero is a side effect of allowing structures to work with the local label mechanism: if your structure members tend to have the same names in more than one structure, you can define the above structure like this:

struc mytype

.long: resd 1

.word: resw 1

.byte: resb 1

.str: resb 32

endstruc

This defines the offsets to the structure fields asmytype.long,mytype.word,mytype.byteandmytype.str.

Since NASM syntax has nointrinsicstructure support, does not support any form of period notation to refer to the elements of a structure once you have one (except the above local-label notation), so code such asmov ax,[mystruc.mt_word]is not valid.mt_wordis a constant just like any other constant, so the correct syntax ismov ax,[mystruc+mt_word]ormov ax,[mystruc+mytype.word].

4.8.5.ISTRUC,ATandIEND: Declaring Instances of Structures

Having defined a structure type, the next thing you typically want to do is to declare instances of that structure in your data segment. The NASM preprocessor provides an easy way to do this in theISTRUCmechanism. To declare a structure of typemytypein a program, you code something like this:

mystruc: istruc mytype

at mt_long, dd 123456

at mt_word, dw 1024

at mt_byte, db 'x'

at mt_str, db 'hello, world', 13, 10, 0

iend

The function of theATmacro is to make use of theTIMESprefix to advance the assembly position to the correct point for the specified structure field, and then to declare the specified data. Therefore the structure fields must be declared in the same order as they were specified in the structure definition.

If the data to go in a structure field requires more than one source line to specify, the remaining source lines can easily come after theATline. For example:

at mt_str, db 123,134,145,156,167,178,189

db 190,100,0

Depending on personal taste, you can also omit the code part of theATline completely, and start the structure field on the next line:

at mt_str

db 'hello, world'

db 13,10,0

4.8.6.ALIGNandALIGNB: Data Alignment

TheALIGNandALIGNBmacros provide a convenient way to align code or data on a word, longword, paragraph or other boundary. The syntax of theALIGNandALIGNBmacros is

align 4 ; align on 4-byte boundary

align 16 ; align on 16-byte boundary

align 16,nop ; equivalent to previous line

align 8,db 0 ; pad with 0s rather than NOPs

align 4,resb 1 ; align to 4 in the BSS

alignb 4 ; equivalent to previous line

Both macros require their first argument to be a power of two; they both compute the number of additional bytes required to bring the length of the current section up to a multiple of that power of two, and output either NOP fill or apply theTIMESprefix to their second argument to perform the alignment.

If the second argument is not specified, the default forALIGNisNOP, and the default forALIGNBisRESB 1.ALIGNtreats aNOPargument specially by generating maximal NOP fill instructions (not necessarily NOP opcodes) for the currentBITSsetting, whereasALIGNBtakes its second argument literally. Otherwise, the two macros are equivalent when a second argument is specified. Normally, you can just useALIGNin code and data sections andALIGNBin BSS sections, and never need the second argument except for special purposes.

ALIGNandALIGNB, being simple macros, perform no error checking: they cannot warn you if their first argument fails to be a power of two, or if their second argument generates more than one byte of code. In each of these cases they will silently do the wrong thing.

ALIGNB(orALIGNwith a second argument ofRESB 1) can be used within structure definitions:

struc mytype2

mt_byte: resb 1

alignb 2

mt_word: resw 1

alignb 4

mt_long: resd 1

mt_str: resb 32

endstruc

This will ensure that the structure members are sensibly aligned relative to the base of the structure.

A final caveat:ALIGNBworks relative to the beginning of thesection, not the beginning of the address space in the final executable. Aligning to a 16-byte boundary when the section you're in is only guaranteed to be aligned to a 4-byte boundary, for example, is a waste of effort. Again, Yasm does not check that the section's alignment characteristics are sensible for the use ofALIGNB.ALIGNis more intelligent anddoesadjust the section alignment to be the maximum specified alignment.

Chapter5.NASM Assembler Directives

Table of Contents

5.1. Specifying Target Processor Mode

5.1.1.BITS

5.1.2.USE16,USE32, andUSE64

5.2.DEFAULT: Change the assembler defaults

5.3. Changing and Defining Sections

5.3.1.SECTIONandSEGMENT

5.3.2. Standardized Section Names

5.3.3. The__SECT__Macro

5.4.ABSOLUTE: Defining Absolute Labels

5.5.EXTERN: Importing Symbols

5.6.GLOBAL: Exporting Symbols

5.7.COMMON: Defining Common Data Areas

5.8.CPU: Defining CPU Dependencies

NASM, though it attempts to avoid the bureaucracy of assemblers like MASM and TASM, is nevertheless forced to support afewdirectives. These are described in this chapter.

NASM's directives come in two types:user-leveldirectives andprimitivedirectives. Typically, each directive has a user-level form and a primitive form. In almost all cases, we recommend that users use the user-level forms of the directives, which are implemented as macros which call the primitive forms.

Primitive directives are enclosed in square brackets; user-level directives are not.

In addition to the universal directives described in this chapter, each object file format can optionally supply extra directives in order to control particular features of that file format. Theseformat-specificdirectives are documented along with the formats that implement them, inPartIV.

5.1.Specifying Target Processor Mode

5.1.1.BITS

TheBITSdirective specifies whether Yasm should generate code designed to run on a processor operating in 16-bit mode, 32-bit mode, or 64-bit mode. The syntax isBITS 16,BITS 32, orBITS 64.

In most cases, you should not need to useBITSexplicitly. Thecoff,elf32,macho32, andwin32object formats, which are designed for use in 32-bit operating systems, all cause Yasm to select 32-bit mode by default. Theelf64,macho64, andwin64object formats, which are designed for use in 64-bit operating systems, both cause Yasm to select 64-bit mode by default. Thexdfobject format allows you to specify each segment you define asUSE16,USE32, orUSE64, and Yasm will set its operating mode accordingly, so the use of theBITSdirective is once again unnecessary.

The most likely reason for using theBITSdirective is to write 32-bit or 64-bit code in a flat binary file; this is because thebinobject format defaults to 16-bit mode in anticipation of it being used most frequently to write DOS.COMprograms, DOS.SYSdevice drivers and boot loader software.

You donotneed to specifyBITS 32merely in order to use 32-bit instructions in a 16-bit DOS program; if you do, the assembler will generate incorrect code because it will be writing code targeted at a 32-bit platform, to be run on a 16-bit one. However, itisnecessary to specifyBITS 64to use 64-bit instructions and registers; this is done to allow use of those instruction and register names in 32-bit or 16-bit programs, although such use will generate a warning.

When Yasm is inBITS 16mode, instructions which use 32-bit data are prefixed with an 0x66 byte, and those referring to 32-bit addresses have an 0x67 prefix. InBITS 32mode, the reverse is true: 32-bit instructions require no prefixes, whereas instructions using 16-bit data need an 0x66 and those working in 16-bit addresses need an 0x67.

When Yasm is inBITS 64mode, 32-bit instructions usually require no prefixes, and most uses of 64-bit registers or data size requires a REX prefix. Yasm automatically inserts REX prefixes where necessary. There are also 8 more general and SSE registers, and 16-bit addressing is no longer supported. The default address size is 64 bits; 32-bit addressing can be selected with the 0x67 prefix. The default operand size is still 32 bits, however, and the 0x66 prefix selects 16-bit operand size. The REX prefix is used both to select 64-bit operand size, and to access the new registers. A few instructions have a default 64-bit operand size.

When the REX prefix is used, the processor does not know how to address theAH,BH,CHorDH(high 8-bit legacy) registers. Instead, it is possible to access the the low 8-bits of theSP,BPSI, andDIregisters asSPL,BPL,SIL, andDIL, respectively; but only when the REX prefix is used.

TheBITSdirective has an exactly equivalent primitive form,[BITS 16],[BITS 32], and[BITS 64]. The user-level form is a macro which has no function other than to call the primitive form.

5.1.2.USE16,USE32, andUSE64

TheUSE16,USE32, andUSE64directives can be used in place ofBITS 16,BITS 32, andBITS 64respectively for compatibility with other assemblers.

5.2.DEFAULT: Change the assembler defaults

TheDEFAULTdirective changes the assembler defaults. Normally, Yasm defaults to a mode where the programmer is expected to explicitly specify most features directly. However, sometimes this is not desirable if a certain behavior is very commmonly used.

Currently, the onlyDEFAULTthat is settable is whether or not registerless effective addresses in 64-bit mode areRIP-relative or not. By default, they are absolute unless overridden with theRELspecifier (seeSection3.3). However, ifDEFAULT RELis specified,RELis default, unless overridden with theABSspecifier, aFSorGSsegment override is used, or another register is part of the effective address.

The special handling ofFSandGSoverrides are due to the fact that these segments are the only segments which can have non-0 base addresses in 64-bit mode, and thus are generally used as thread pointers or other special functions. With a non-zero base address, generatingRIP-relative addresses for these forms would be extremely confusing. Other segment registers such asDSalways have a base address of 0, so RIP-relative access still makes sense.

DEFAULT RELis disabled withDEFAULT ABS. The default mode of the assembler at start-up isDEFAULT ABS.

5.3.Changing and Defining Sections

5.3.1.SECTIONandSEGMENT

TheSECTIONdirective (((SEGMENT)) is an exactly equivalent synonym) changes which section of the output file the code you write will be assembled into. In some object file formats, the number and names of sections are fixed; in others, the user may make up as many as they wish. HenceSECTIONmay sometimes give an error message, or may define a new section, if you try to switch to a section that does not (yet) exist.

5.3.2.Standardized Section Names

The Unix object formats, and thebinobject format, all support thestandardised section names.text,.dataand.bssfor the code, data and uninitialised-data sections. Theobjformat, by contrast, does not recognise these section names as being special, and indeed will strip off the leading period of any section name that has one.

5.3.3.The__SECT__Macro

TheSECTIONdirective is unusual in that its user-level form functions differently from its primitive form. The primitive form,[SECTION xyz], simply switches the current target section to the one given. The user-level form,SECTION xyz, however, first defines the single-line macro__SECT__to be the primitive[SECTION]directive which it is about to issue, and then issues it. So the user-level directive

SECTION .text

expands to the two lines

%define __SECT__ [SECTION .text]

[SECTION .text]

Users may find it useful to make use of this in their own macros. For example, thewritefilemacro defined in the NASM Manual can be usefully rewritten in the following more sophisticated form:

%macro writefile 2+

[section .data]

%%str: db %2

%%endstr:

__SECT__

mov dx,%%str

mov cx,%%endstr-%%str

mov bx,%1

mov ah,0x40

int 0x21

%endmacro

This form of the macro, once passed a string to output, first switches temporarily to the data section of the file, using the primitive form of theSECTIONdirective so as not to modify__SECT__. It then declares its string in the data section, and then invokes__SECT__to switch back towhicheversection the user was previously working in. It thus avoids the need, in the previous version of the macro, to include aJMPinstruction to jump over the data, and also does not fail if, in a complicatedOBJformat module, the user could potentially be assembling the code in any of several separate code sections.

5.4.ABSOLUTE: Defining Absolute Labels

TheABSOLUTEdirective can be thought of as an alternative form ofSECTION: it causes the subsequent code to be directed at no physical section, but at the hypothetical section starting at the given absolute address. The only instructions you can use in this mode are theRESBfamily.

ABSOLUTEis used as follows:

ABSOLUTE 0x1A

kbuf_chr resw 1

kbuf_free resw 1

kbuf resw 16

This example describes a section of the PC BIOS data area, at segment address 0x40: the above code defineskbuf_chrto be 0x1A,kbuf_freeto be 0x1C, andkbufto be 0x1E.

The user-level form ofABSOLUTE, like that ofSECTION, redefines the__SECT__macro when it is invoked.

STRUCandENDSTRUCare defined as macros which useABSOLUTE(and also__SECT__).

ABSOLUTEdoesn't have to take an absolute constant as an argument: it can take an expression (actually, acritical expression: seeSection3.8) and it can be a value in a segment. For example, a TSR can re-use its setup code as run-time BSS like this:

org 100h ; it's a .COM program

jmp setup ; setup code comes last

; the resident part of the TSR goes here

setup: ; now write the code that installs the TSR here

absolute setup

runtimevar1 resw 1

runtimevar2 resd 20

tsr_end:

This defines some variables"on top of"the setup code, so that after the setup has finished running, the space it took up can be re-used as data storage for the running TSR. The symbol"tsr_end"can be used to calculate the total size of the part of the TSR that needs to be made resident.

5.5.EXTERN: Importing Symbols

EXTERNis similar to the MASM directiveEXTRNand the C keywordextern: it is used to declare a symbol which is not defined anywhere in the module being assembled, but is assumed to be defined in some other module and needs to be referred to by this one. Not every object-file format can support external variables: thebinformat cannot.

TheEXTERNdirective takes as many arguments as you like. Each argument is the name of a symbol:

extern _printf

extern _sscanf, _fscanf

Some object-file formats provide extra features to theEXTERNdirective. In all cases, the extra features are used by suffixing a colon to the symbol name followed by object-format specific text. For example, theobjformat allows you to declare that the default segment base of an external should be the groupdgroupby means of the directive

extern _variable:wrt dgroup

The primitive form ofEXTERNdiffers from the user-level form only in that it can take only one argument at a time: the support for multiple arguments is implemented at the preprocessor level.

You can declare the same variable asEXTERNmore than once: NASM will quietly ignore the second and later redeclarations. You can't declare a variable asEXTERNas well as something else, though.

5.6.GLOBAL: Exporting Symbols

GLOBALis the other end ofEXTERN: if one module declares a symbol asEXTERNand refers to it, then in order to prevent linker errors, some other module must actuallydefinethe symbol and declare it asGLOBAL. Some assemblers use the namePUBLICfor this purpose.

TheGLOBALdirective applying to a symbol must appearbeforethe definition of the symbol.

GLOBALuses the same syntax asEXTERN, except that it must refer to symbols whicharedefined in the same module as theGLOBALdirective. For example:

global _main

_main: ; some code

GLOBAL, likeEXTERN, allows object formats to define private extensions by means of a colon. Theelfobject format, for example, lets you specify whether global data items are functions or data:

global hashlookup:function, hashtable:data

LikeEXTERN, the primitive form ofGLOBALdiffers from the user-level form only in that it can take only one argument at a time.

5.7.COMMON: Defining Common Data Areas

TheCOMMONdirective is used to declarecommon variables. A common variable is much like a global variable declared in the uninitialised data section, so that

common intvar 4

is similar in function to

global intvar

section .bss

intvar resd 1

The difference is that if more than one module defines the same common variable, then at link time those variables will bemerged, and references tointvarin all modules will point at the same piece of memory.

LikeGLOBALandEXTERN,COMMONsupports object-format specific extensions. For example, theobjformat allows common variables to be NEAR or FAR, and theelfformat allows you to specify the alignment requirements of a common variable:

common commvar 4:near ; works in OBJ

common intarray 100:4 ; works in ELF: 4 byte aligned

Once again, likeEXTERNandGLOBAL, the primitive form ofCOMMONdiffers from the user-level form only in that it can take only one argument at a time.

5.8.CPU: Defining CPU Dependencies

TheCPUdirective restricts assembly to those instructions which are available on the specified CPU. SeePartVIforCPUoptions for various architectures.

All options are case insensitive. Instructions will be enabled only if they apply to the selected cpu or lower.

PartIII.GAS Syntax

The chapters in this part of the book document the GNU AS-compatible syntax accepted by the Yasm"gas"parser.

Table of Contents

6. TBD

Chapter6.TBD

To be written.

PartIV.Object Formats

The chapters in this part of the book document Yasm's support for various object file formats.

Chapter7.bin: Flat-Form Binary Output

Thebin"object format"does not produce object files: the output file produced contains only the section data; no headers or relocations are generated. The output can be considered"plain binary", and is useful for operating system and boot loader development, generating MS-DOS.COMexecutables and.SYSdevice drivers, and creating images for embedded target environments (e.g.Flash ROM).

Thebinobject format supports an unlimited number of named sections. SeeSection7.2for details. The only restriction on these sections is that their storage locations in the output file cannot overlap.

When used with the x86 architecture, thebinobject format starts Yasm in 16-bit mode. In order to write native 32-bit or 64-bit code, an explicitBITS 32orBITS 64directive is required respectively.

binproduces an output file with no extension by default; it simply strips the extension from the input file name. Thus the default output filename for the input filefoo.asmis simplyfoo.

7.1.ORG: Binary Origin

binprovides theORGdirective in NASM syntax to allow setting of the memory address at which the output file is initially loaded. TheORGdirective may only be used once (as the output file can only be initially loaded into a single location). IfORGis not specified,ORG 0is used by default.

This makes the operation of NASM-syntaxORGvery different from the operation ofORGin other assemblers, which typically simply move the assembly location to the value given.binprovides a more powerful alternative in the form of extensions to theSECTIONdirective; seeSection7.2for details.

When combined with multiple sections,ORGalso has the effect of defaulting the LMA of the first section to theORGvalue to make the output file as small as possible. If this is not the desired behavior, explicitly specify a LMA for all sections via eitherSTARTorFOLLOWSqualifiers in theSECTIONdirective.

7.2.binExtensions to theSECTIONDirective

Thebinobject format allows the use of multiple sections of arbitrary names. It also extends theSECTION(orSEGMENT) directive to allow complex ordering of the segments both in the output file or initial load address (also known as LMA) and at the ultimate execution address (the virtual address or VMA).

TheVMA is the execution address. Yasm calculates absolute memory references within a section assuming that the program code is at the VMA while being executed. The LMA, on the other hand, specifies where a section isinitiallyloaded, as well as its location in the output file.

Often, VMA will be the same as LMA. However, they may be different if the program or another piece of code copies (relocates) a section prior to execution. A typical example of this in an embedded system would be a piece of code stored in ROM, but is copied to faster RAM prior to execution. Another example would be overlays: sections loaded on demand from different file locations to the same execution location.

Thebinextensions to theSECTIONdirective allow flexible specification of both VMA and LMA, including alignment constraints. As with other object formats, additional attributes may be added after the section name. The available attributes are listed inTable7.1.

Table7.1.binSection Attributes

Attribute

Indicates the section

progbits

is stored in the disk image, as opposed to allocated and initialized at load.

nobits

is allocated and initialized at load (the opposite ofprogbits). Only one ofprogbitsornobitsmay be specified; they are mutually exclusive attributes.

start=address

has an LMA starting ataddress. If a LMA alignment constraint is given, it is checked against the provided address and a warning is issued ifaddressdoes not meet the alignment constraint.

follows=sectname

should follow the section namedsectnamein the output file (LMA). If a LMA alignment constraint is given, it is respected and a gap is inserted such that the section meets its alignment requirement. Note that as LMA overlap is not allowed, typically only one section may follow another.

align=n

requires a LMA alignment ofnbytes. The valuenmust always be a power of 2. LMA alignment defaults to 4 if not specified.

vstart=address

has an VMA starting ataddress. If a VMA alignment constraint is given, it is checked against the provided address and a warning is issued ifaddressdoes not meet the alignment constraint.

vfollows=sectname

should follow the section namedsectnamein the output file (VMA). If a VMA alignment constraint is given, it is respected and a gap is inserted such that the section meets its alignment requirement. VMA overlap is allowed, so more than one section may follow another (possibly useful in the case of overlays).

valign=n

requires a VMA alignment ofnbytes. The valuenmust always be a power of 2. VMA alignment defaults to the LMA alignment if not specified.


Only one ofstartorfollowsmay be specified for a section; the same restriction applies tovstartandvfollows.

Unless otherwise specified via the use offollowsorstart, Yasm by default assumes the implicit ordering given by the order of the sections in the input file. A section named.textis always the first section. Any code which comes before an explicitSECTIONdirective goes into the.textsection. The.textsection attributes may be overridden by giving an explicitSECTION .textdirective with attributes.

Also, unless otherwise specified, Yasm defaults to setting VMA=LMA. If just"valign` is specified, Yasm just takes the LMA and aligns it to the required alignment. This may have the effect of pushing following sections"VMAs to non-LMA addresses as well, to avoid VMA overlap.

Yasm treatsnobitssections in a special way in order to minimize the size of the output file. Asnobitssections can be 0-sized in the LMA realm, but cannot be if located between two other sections (due to the VMA=LMA default), Yasm moves allnobitssections with unspecified LMA to the end of the output file, where they can savely have 0 LMA size and thus not take up any space in the output file. If this behavior is not desired, anobitssection LMA (just like aprogbitssection) may be specified using either thefollowsorstartsection attribute.

7.3.binSpecial Symbols

To facilitate writing code that copies itself from one location to another (e.g. from its LMA to its VMA during execution), thebinobject format provides several special symbols for every defined section. Each special symbol begins withsection.followed by the section name. The supported specialbinsymbols are:

section.sectname.start

Set to the LMA address of the section namedsectname.

section.sectname.vstart

Set to the VMA address of the section namedsectname.

section.sectname.length

Set to the length of the section namedsectname. The length is considered the runtime length, so"nobits` sections"length is their runtime length, not 0.

7.4.Map Files

Map files may be generated inbinvia the use of the[MAP]directive. The map filename may be specified either with a command line option (--mapfile=filename) or in the[MAP]directive. If a map is requested but no output filename is given, the map output goes to standard output by default.

If no[MAP]directive is given in the input file, no map output is generated. If[MAP]is given with no options, a brief map is generated. The[MAP]directive accepts the following options to control what is included in the map file. More than one option may be specified. Any option other than the ones below is interpreted as the output filename.

brief

Includes the input and output filenames, origin (ORGvalue), and a brief section summary listing the VMA and LMA start and stop addresses and the section length of every section.

sections,segments

Includes a detailed list of sections, including the VMA and LMA alignment, any"follows"settings, as well as the VMA and LMA start addresses and the section length.

symbols

Includes a detailed list of all EQU values and VMA and LMA symbol locations, grouped by section.

all

All of the above.

Chapter8.coff: Common Object File Format

Chapter9.elf32: Executable and Linkable Format 32-bit Object Files

Table of Contents

9.1. Debugging Format Support

9.2. ELF Sections

9.3. ELF Directives

9.3.1.IDENT: Add file identification

9.3.2.SIZE: Set symbol size

9.3.3.TYPE: Set symbol type

9.3.4.WEAK: Create weak symbol

9.4. ELF Extensions to theGLOBALDirective

9.5. ELF Extensions to theCOMMONDirective

9.6.elf32Special Symbols andWRT

The Executable and Linkable Object Format is the primary object format for many operating systems includingFreeBSD or GNU/Linux. It appears in three forms:

Shared object files (.so)
Relocatable object files (.o)
Executable files (no convention)

Yasm only directly supports relocatable object files. Other tools, such as the GNU Linkerld, help turn relocatable object files into the other formats. Yasm supports generation of both 32-bit and 64-bit ELF files, calledelf32andelf64. An additional format, calledelfx32, is a 32-bit ELF file that supports 64-bit execution (instructions and registers) while limiting pointer sizes to 32-bit.

Yasm defaults toBITS 32mode when outputting to theelf32object format.

9.1.Debugging Format Support

ELF supports two debugging formats:stabs(seeChapter20) anddwarf2(seeChapter19). Different debuggers understand these different formats; the newer debug format isdwarf2, so try that first.

9.2.ELF Sections

ELF's section-based output supports attributes on a per-section basis. These attributes includealloc,exec,write,progbits, andalign. Except for align, they can each be negated in NASM syntax by prepending"no", e.g.,"noexec". The attributes are later read by the operating system to select the proper behavior for each section, with the meanings shown inTable9.1.

Table9.1.ELF Section Attributes

Attribute

Indicates the section

alloc

is loaded into memory at runtime. This is true for code and data sections, and false for metadata sections.

exec

has permission to be run as executable code.

write

is writable at runtime.

progbits

is stored in the disk image, as opposed to allocated and initialized at load.

align=n

requires a memory alignment ofnbytes. The valuenmust always be a power of 2.


In NASM syntax, the attributenobitsis provided as an alias fornoprogbits.

The standard primary sections have attribute defaults according their expected use, and any unknown section gets its own defaults, as shown inTable9.2.

Table9.2.ELF Standard Sections

Section

alloc

exec

write

progbits

align

.bss

alloc

write

4

.data

alloc

write

progbits

4

.rodata

alloc

progbits

4

.text

alloc

exec

progbits

16

.comment

progbits

0

unknown

alloc

progbits

1


9.3.ELF Directives

ELF adds additional assembler directives to define weak symbols (WEAK), set symbol size (SIZE), and indicate whether a symbol is specifically a function or an object (TYPE). ELF also adds a directive to assist in identifying the source file or version,IDENT.

9.3.1.IDENT: Add file identification

TheIDENTdirective allows adding arbitrary string data to an ELF object file that will be saved in the object and executable file, but will not be loaded into memory like data in the.datasection. It is often used for savingversion control keyword information from tools such ascvsorsvninto files so that the source revision the object was created with can be read using theidentcommand found on most Unix systems.

The directive takes one or more string parameters. Each parameter is saved in sequence as a 0-terminated string in the.commentsection of the object file. Multiple uses of theIDENTdirective are legal, and the strings will be saved into the.commentsection in the order given in the source file.

In NASM syntax, no wrapper macro is provided forIDENT, so it must be wrapped in square brackets. Example use in NASM syntax:

[ident "$Id$"]

9.3.2.SIZE: Set symbol size

ELF's symbol table has the capability of storing a size for a symbol. This is commonly used for functions or data objects. While the size can be specificed directly forCOMMONsymbols, theSIZEdirective allows for specifying the size of any symbol, including local symbols.

The directive takes two parameters; the first parameter is the symbol name, and the second is the size. The size may be a constant or an expression. Example:

func:

ret

.end:

size func func.end-func

9.3.3.TYPE: Set symbol type

ELF's symbol table has the capability of indicating whether a symbol is a function or data. While this can be specified directly in theGLOBALdirective (seeSection9.4), theTYPEdirective allows specifying the symbol type for any symbol, including local symbols.

The directive takes two parameters; the first parameter is the symbol name, and the second is the symbol type. The symbol type must be eitherfunctionorobject. An unrecognized type will cause a warning to be generated. Example of use:

func:

ret

type func function

section .data

var dd 4

type var object

9.3.4.WEAK: Create weak symbol

ELF allows defining certain symbols as"weak". Weak symbols are similar to global symbols, except during linking, weak symbols are only chosen after global and local symbols during symbol resolution. Unlike global symbols, multiple object files may declare the same weak symbol, and references to a symbol get resolved against a weak symbol only if no global or local symbols have the same name.

This functionality is primarily useful for libraries that want to provide common functions but not come into conflict with user programs. For example, libc has a syscall (function) called"read". However, to implement a threaded process using POSIX threads in user-space, libpthread needs to supply a function also called"read"that provides a blocking interface to the programmer, but actually does non-blocking calls to the kernel. To allow an application to be linked to both libc and libpthread (to share common code), libc needs to have its version of the syscall with a non-weak name like"_sys_read"with a weak symbol called"read". If an application is linked against libc only, the linker won't find a non-weak symbol for"read", so it will use the weak one. If the same application is linked against libcandlibpthread, then the linker will link"read"calls to the symbol in libpthread, ignoring the weak one in libc, regardless of library link order. If libc used a non-weak name, which"read"function the program ended up with might depend on a variety of factors; a weak symbol is a way to tell the linker that a symbol is less important resolution-wise.

TheWEAKdirective takes a single parameter, the symbol name to declare weak. Example:

weakfunc:

strongfunc:

ret

weak weakfunc

global strongfunc

9.4.ELF Extensions to theGLOBALDirective

ELF object files can contain more information about a global symbol than just its address: they can contain the size of the symbol and its type as well. These are not merely debugger conveniences, but are actually necessary when the program being written is a ((shared library)). Yasm therefore supports some extensions to the NASM syntaxGLOBALdirective (seeSection5.6), allowing you to specify these features. Yasm also provides the ELF-specific directives inSection9.3to allow specifying this information for non-global symbols.

You can specify whether a global variable is a function or a data object by suffixing the name with a colon and the wordfunctionordata. (((object)) is a synonym fordata.) For example:

global hashlookup:function, hashtable:data

exports the global symbolhashlookupas a function andhashtableas a data object.

Optionally, you can control the ELF visibility of the symbol. Just add one of the visibility keywords:default,internal,hidden, orprotected. The default isdefault, of course. For example, to makehashlookuphidden:

global hashlookup:function hidden

You can also specify the size of the data associated with the symbol, as a numeric expression (which may involve labels, and even forward references) after the type specifier. Like this:

global hashtable:data (hashtable.end - hashtable)


hashtable:

db this,that,theother ; some data here

.end:

This makes Yasm automatically calculate the length of the table and place that information into the ELF symbol table. The same information can be given more verbosely using theTYPE(seeSection9.3.3) andSIZE(seeSection9.3.2) directives as follows:

global hashtable

type hashtable object

size hashtable hashtable.end - hashtable

hashtable:

db this,that,theother ; some data here

.end:

Declaring the type and size of global symbols is necessary when writing shared library code.

9.5.ELF Extensions to theCOMMONDirective

ELF also allows you to specify alignment requirements on common variables. This is done by putting a number (which must be a power of two) after the name and size of the common variable, separated (as usual) by a colon. For example, an array of doublewords would benefit from 4-byte alignment:

common dwordarray 128:4

This declares the total size of the array to be 128 bytes, and requires that it be aligned on a 4-byte boundary.

9.6.elf32Special Symbols andWRT

The ELF specification contains enough features to allow position-independent code (PIC) to be written, which makes ELF shared libraries very flexible. However, it also means Yasm has to be able to generate a variety of strange relocation types in ELF object files, if it is to be an assembler which can writePIC.

Since ELF does not support segment-base references, theWRToperator is not used for its normal purpose; therefore Yasm'self32output format makes use ofWRTfor a different purpose, namely the PIC-specific relocation types.

elf32defines five special symbols which you can use as the right-hand side of theWRToperator to obtain PIC relocation types. They are..gotpc,..gotoff,..got,..pltand..sym. Their functions are summarized here:

..gotpc

Referring to the symbol marking theglobal offset table base usingwrt ..gotpcwill end up giving the distance from the beginning of the current section to the global offset table. (((_GLOBAL_OFFSET_TABLE_)) is the standard symbol name used to refer to theGOT.) So you would then need to add$$to the result to get the real address of the GOT.

..gotoff

Referring to a location in one of your own sections usingwrt ..gotoffwill give the distance from the beginning of the GOT to the specified location, so that adding on the address of the GOT would give the real address of the location you wanted.

..got

Referring to an external or global symbol usingwrt ..gotcauses the linker to build an entryinthe GOT containing the address of the symbol, and the reference gives the distance from the beginning of the GOT to the entry; so you can add on the address of the GOT, load from the resulting address, and end up with the address of the symbol.

..plt

Referring to a procedure name usingwrt ..pltcauses the linker to build aprocedure linkage table entry for the symbol, and the reference gives the address of thePLT entry. You can only use this in contexts which would generate a PC-relative relocation normally (i.e. as the destination forCALLorJMP), since ELF contains no relocation type to refer to PLT entries absolutely.

..sym

Referring to a symbol name usingwrt ..symcauses Yasm to write an ordinary relocation, but instead of making the relocation relative to the start of the section and then adding on the offset to the symbol, it will write a relocation record aimed directly at the symbol in question. The distinction is a necessary one due to a peculiarity of the dynamic linker.

Chapter10.elf64: Executable and Linkable Format 64-bit Object Files

Table of Contents

10.1.elf64Special Symbols andWRT

Theelf64object format is the 64-bit version of the Executable and Linkable Object Format. As it shares many similarities withelf32, only differences betweenelf32andelf64will be described in this chapter. For details onelf32, seeChapter9.

Yasm defaults toBITS 64mode when outputting to theelf64object format.

elf64supports the same debug formats aself32, however, thestabsdebug format is limited to 32-bit addresses, sodwarf2(seeChapter19) is the recommended debugging format.

elf64also supports the exact same sections, section attributes, and directives aself32. SeeSection9.2for more details on section attributes, andSection9.3for details on the additional directives ELF provides.

10.1.elf64Special Symbols andWRT

The primary difference betweenelf32andelf64(other than 64-bit support in general) is the differences in shared library handling and position-independent code. AsBITS 64enables the use ofRIP-relative addressing, most variable accesses can be relative to RIP, allowing easy relocation of the shared library to a different memory address.

While RIP-relative addressing is available, it does not handle all possible variable access modes, so special symbols are still required, as inelf32. And as withelf32, theelf64output format makes use ofWRTfor utilizing thePIC-specific relocation types.

elf64defines four special symbols which you can use as the right-hand side of theWRToperator to obtain PIC relocation types. They are..gotpcrel,..got,..pltand..sym. Their functions are summarized here:

..gotpcrel

While RIP-relative addressing allows you to encode an instruction pointer relative data reference tofoowith[rel foo], it's sometimes necessary to encode a RIP-relative reference to a linker-generated symbol pointer for symbol foo; this is done usingwrt ..gotpcrel, e.g.[rel foo wrt ..gotpcrel]. Unlike inelf32, this relocation, combined with RIP-relative addressing, makes it possible to load an address from the ((global offset table)) using a single instruction. Note that since RIP-relative references are limited to a signed 32-bit displacement, theGOT size accessible through this method is limited to 2 GB.

..got

As inelf32, referring to an external or global symbol usingwrt ..gotcauses the linker to build an entryinthe GOT containing the address of the symbol, and the reference gives the distance from the beginning of the GOT to the entry; so you can add on the address of the GOT, load from the resulting address, and end up with the address of the symbol.

..plt

As inelf32, referring to a procedure name usingwrt ..pltcauses the linker to build aprocedure linkage table entry for the symbol, and the reference gives the address of thePLT entry. You can only use this in contexts which would generate a PC-relative relocation normally (i.e. as the destination forCALLorJMP), since ELF contains no relocation type to refer to PLT entries absolutely.

..sym

As inelf32, referring to a symbol name usingwrt ..symcauses Yasm to write an ordinary relocation, but instead of making the relocation relative to the start of the section and then adding on the offset to the symbol, it will write a relocation record aimed directly at the symbol in question. The distinction is a necessary one due to a peculiarity of the dynamic linker.

Chapter11.elfx32: ELF 32-bit Object Files for 64-bit Processors

Table of Contents

11.1.elfx32Special Symbols andWRT

Theelfx32object format is the 32-bit version of the Executable and Linkable Object Format for 64-bit execution. Similar toelf64, it allows for use of 64-bit registers and instructions, but likeelf32, limits pointers to 32 bits in size. As it shares many similarities withelf32andelf64, only differences between these formats andelfx32will be described in this chapter. For details onelf32, seeChapter9; for details onelf64, seeChapter10. Operating system support forelfx32is currently less common than forelf64.

Yasm defaults toBITS 64mode when outputting to theelfx32object format.

elfx32supports the same debug formats, sections, section attributes, and directives aself32andelf64. SeeSection9.2for more details on section attributes, andSection9.3for details on the additional directives ELF provides.

11.1.elfx32Special Symbols andWRT

Due to the availability of RIP-relative addressing,elfx32shared library handling and position-independent code is essentially identical toelf64.

As inelf64,elfx32defines four special symbols which you can use as the right-hand side of theWRToperator to obtain PIC relocation types. They are..gotpcrel,..got,..pltand..symand have the same functionality as they do inelf64. Their functions are summarized here:

..gotpcrel

While RIP-relative addressing allows you to encode an instruction pointer relative data reference tofoowith[rel foo], it's sometimes necessary to encode a RIP-relative reference to a linker-generated symbol pointer for symbol foo; this is done usingwrt ..gotpcrel, e.g.[rel foo wrt ..gotpcrel]. As inelf64, this relocation, combined with RIP-relative addressing, makes it possible to load an address from the ((global offset table)) using a single instruction. Note that since RIP-relative references are limited to a signed 32-bit displacement, theGOT size accessible through this method is limited to 2 GB.

..got

As inelf64, referring to an external or global symbol usingwrt ..gotcauses the linker to build an entryinthe GOT containing the address of the symbol, and the reference gives the distance from the beginning of the GOT to the entry; so you can add on the address of the GOT, load from the resulting address, and end up with the address of the symbol.

..plt

As inelf64, referring to a procedure name usingwrt ..pltcauses the linker to build aprocedure linkage table entry for the symbol, and the reference gives the address of thePLT entry. You can only use this in contexts which would generate a PC-relative relocation normally (i.e. as the destination forCALLorJMP), since ELF contains no relocation type to refer to PLT entries absolutely.

..sym

As inelf64, referring to a symbol name usingwrt ..symcauses Yasm to write an ordinary relocation, but instead of making the relocation relative to the start of the section and then adding on the offset to the symbol, it will write a relocation record aimed directly at the symbol in question. The distinction is a necessary one due to a peculiarity of the dynamic linker.

Chapter12.macho32: Mach 32-bit Object File Format

Chapter13.macho64: Mach 64-bit Object File Format

Chapter14.rdf: Relocatable Dynamic Object File Format

Chapter15.win32: Microsoft Win32 Object Files

Table of Contents

15.1.win32Extensions to theSECTIONDirective

15.2.win32: Safe Structured Exception Handling

Thewin32object format generates MicrosoftWin32 object files for use on the 32-bit nativeWindows XP (and Vista) platforms. Object files produced using this object format may be linked with 32-bit Microsoft linkers such asVisual Studio in order to produce 32-bitPE executables.

Thewin32object format provides a default output filename extension of.obj.

Note that although Microsoft say that Win32 object files follow theCOFF(Common Object File Format) standard, the object files produced by Microsoft Win32 compilers are not compatible with COFF linkers such as DJGPP's, and vice versa. This is due to a difference of opinion over the precise semantics of PC-relative relocations. To produce COFF files suitable for DJGPP, use thecoffoutput format; conversely, thecoffformat does not produce object files that Win32 linkers can generate correct output from.

15.1.win32Extensions to theSECTIONDirective

Thewin32object format allows you to specify additional information on theSECTIONdirective line, to control the type and properties of sections you declare. Section types and properties are generated automatically by Yasm for thestandard section names.text,.dataand.bss, but may still be overridden by these qualifiers.

The available qualifiers are:

codeortext

Defines the section to be a code section. This marks the section as readable and executable, but not writable, and also indicates to the linker that the type of the section is code.

dataorbss

Defines the section to be a data section, analogously tocode. Data sections are marked as readable and writable, but not executable.datadeclares an initialized data section, whereasbssdeclares an uninitialized data section.

rdata

Declares an initialized data section that is readable but not writable. Microsoft compilers use this section to place constants in it.

info

Defines the section to be aninformational section, which is not included in the executable file by the linker, but may (for example) pass informationtothe linker. For example, declaring aninfo-type section called.drectvecauses the linker to interpret the contents of the section as command-line options.

align=n

Specifies the alignment requirements of the section. The maximum you may specify is 8192: the Win32 object file format contains no means to request a greater section alignment. If alignment is not explicitly specified, the defaults are 16-byte alignment for code sections, 8-byte alignment for rdata sections and 4-byte alignment for data (and BSS) sections. Informational sections get a default alignment of 1 byte (no alignment), though the value does not matter. The alignment must be a power of 2.

Other qualifiers are supported which control specific section flags:discard,cache,page,share,execute,read,write, andbase. Each of these sets the similarly-named section flag, while prefixing them withnoclears the corresponding section flag; e.g.nodiscardclears the discard flag.

The defaults assumed by Yasm if you do not specify the above qualifiers are:

section .text code align=16

section .data data align=4

section .rdata rdata align=8

section .rodata rdata align=8

section .rdata$ rdata align=8

section .bss bss align=4

section .drectve info

section .comment info

Any other section name is treated by default like.text.

15.2.win32: Safe Structured Exception Handling

Among other improvements in Windows XP SP2 and Windows Server 2003 Microsoft introduced the concept of "safe structured exception handling." The general idea is to collect handlers' entry points in a designated read-only table and have each entry point verified against this table for exceptions prior to control being passed to the handler. In order for an executable to be created with a safe exception handler table, each object file on the linker command line must contain a special symbol named@feat.00. If any object file passed to the linker does not have this symbol, then the exception handler table is omitted from the executable and thus the run-time checks will not be performed for the application. By default, the table is omitted from the executable silently if this happens and therefore can be easily overlooked. A user can instruct the linker to refuse to produce an executable without this table by passing the/safesehcommand line option.

As of version 1.1.0, Yasm adds this special symbol towin32object files so its output does not fail to link with/safeseh.

Yasm also has directives to support registering custom exception handlers. Thesafesehdirective instructs the assembler to produce appropriately formatted input data for the safe exception handler table. A typical use case is given inExample15.1.

Example15.1.Win32safesehExample

section .text

extern _MessageBoxA@16

safeseh handler ; register handler as "safe handler"

handler:

push DWORD 1 ; MB_OKCANCEL

push DWORD caption

push DWORD text

push DWORD 0

call _MessageBoxA@16

sub eax,1 ; incidentally suits as return value

; for exception handler

ret

global _main

_main:

push DWORD handler

push DWORD [fs:0]

mov DWORD [fs:0],esp ; engage exception handler

xor eax,eax

mov eax,DWORD[eax] ; cause exception

pop DWORD [fs:0] ; disengage exception handler

add esp,4

ret

text: db 'OK to rethrow, CANCEL to generate core dump',0

caption:db 'SEGV',0


section .drectve info

db '/defaultlib:user32.lib /defaultlib:msvcrt.lib '


If an application has a safe exception handler table, attempting to execute any unregistered exception handler will result in immediate program termination. Thus it is important to register each exception handler's entry point with thesafesehdirective.

All mentions of linker in this section refer to the Microsoft linker version 7.x and later. The presence of the@feat.00symbol and the data for the safe exception handler table cause no backward incompatibilities and thus "safeseh" object files generated can still be linked by earlier linker versions or by non-Microsoft linkers.

Chapter16.win64: PE32+ (Microsoft Win64) Object Files

Table of Contents

16.1.win64Extensions to theSECTIONDirective

16.2.win64Structured Exception Handling

16.2.1. x64 Stack, Register and Function Parameter Conventions

16.2.2. Types of Functions

16.2.3. Frame Function Structure

16.2.4. Stack Frame Details

16.2.5. Yasm Primitives for Unwind Operations

16.2.6. Yasm Macros for Formal Stack Operations

Thewin64orx64object format generates MicrosoftWin64 object files for use on the 64-bit nativeWindows XP x64 (and Vista x64) platforms. Object files produced using this object format may be linked with 64-bit Microsoft linkers such as that inVisual Studio 2005 and 2008 in order to produce 64-bitPE32+ executables.

win64provides a default output filename extension of.obj.

16.1.win64Extensions to theSECTIONDirective

Like thewin32format,win64allows you to specify additional information on theSECTIONdirective line, to control the type and properties of sections you declare.

16.2.win64Structured Exception Handling

Most functions that make use of the stack in 64-bit versions of Windows must support exception handling even if they make no internal use of such facilities. This is because these operating systems locate exception handlers by using a process called"stack unwinding"that depends on functions providing data that describes how they use the stack.

When an exception occurs the stack is"unwound"by working backwards through the chain of function calls prior to the exception event to determine whether functions have appropriate exception handlers or whether they have saved non-volatile registers whose value needs to be restored in order to reconstruct the execution context of the next higher function in the chain. This process depends on compilers and assemblers providing"unwind data"for functions.

The following sections give details of the mechanisms that are available in Yasm to meet these needs and thereby allow functions written in assembler to comply with the coding conventions used in 64-bit versions of Windows. These Yasm facilities follow those provided in MASM.

16.2.1.x64 Stack, Register and Function Parameter Conventions

Figure16.1shows how the stack is typically used in function calls. When a function is called, an 8 byte return address is automatically pushed onto the stack and the function then saves any non-volatile registers that it will use. Additional space can also be allocated for local variables and a frame pointer register can be assigned if needed.

Figure16.1.x64 Calling Convention



The first four integer function parameters are passed (in left to right order) in the registers RCX, RDX, R8 and R9. Further integer parameters are passed on the stack by pushing them in right to left order (parameters to the left at lower addresses). Stack space is allocated for the four register parameters ("shadow space") but their values are not stored by the calling function so the called function must do this if necessary. The called function effectively owns this space and can use it for any purpose, so the calling function cannot rely on its contents on return. Register parameters occupy the least significant ends of registers and shadow space must be allocated for four register parameters even if the called function doesn't have this many parameters.

The first four floating point parameters are passed in XMM0 to XMM3. When integer and floating point parameters are mixed, the correspondence between parameters and registers is not changed. Hence an integer parameter after two floating point ones will be in R8 with RCX and RDX unused.

When they are passed by value, structures and unions whose sizes are 8, 16, 32 or 64 bits are passed as if they are integers of the same size. Arrays and larger structures and unions are passed as pointers to memory allocated and assigned by the calling function.

The registers RAX, RCX, RDX, R8, R9, R10, R11 are volatile and can be freely used by a called function without preserving their values (note, however, that some may be used to pass parameters). In consequence functions cannot expect these registers to be preserved across calls to other functions.

The registers RBX, RBP, RSI, RDI, R12, R13, R14, R15, and XMM6 to XMM15 are non-volatile and must be saved and restored by functions that use them.

Except for floating point values, which are returned in XMM0, function return values that fit in 64 bits are returned in RAX. Some 128-bit values are also passed in XMM0 but larger values are returned in memory assigned by the calling program and pointed to by an additional"hidden"function parameter that becomes the first parameter and pushes other parameters to the right. This pointer value must also be passed back to the calling program in RAX when the called program returns.

16.2.2.Types of Functions

Functions that allocate stack space, call other functions, save non-volatile registers or use exception handling are called"frame functions"; other functions are called"leaf functions".

Frame functions use an area on the stack called a"stack frame"and have a defined prologue in which this is set up. Typically they save register parameters in their shadow locations (if needed), save any non-volatile registers that they use, allocate stack space for local variables, and establish a register as a stack frame pointer. They must also have one or more defined epilogues that free any allocated stack space and restore non-volatile registers before returning to the calling function.

Unless stack space is allocated dynamically, a frame function must maintain the 16 byte alignment of the stack pointer whilst outside its prologue and epilogue code (except during calls to other functions). A frame function that dynamically allocates stack space must first allocate any fixed stack space that it needs and then allocate and set up a register for indexed access to this area. The lower base address of this area must be 16 byte aligned and the register must be provided irrespective of whether the function itself makes explicit use of it. The function is then free to leave the stack unaligned during execution although it must re-establish the 16 byte alignment if or when it calls other functions.

Leaf functions do not require defined prologues or epilogues but they must not call other functions; nor can they change any non-volatile register or the stack pointer (which means that they do not maintain 16 byte stack alignment during execution). They can, however, exit with a jump to the entry point of another frame or leaf function provided that the respective stacked parameters are compatible.

These rules are summarized inTable16.1(function code that is not part of a prologue or an epilogue are referred to in the table as the function's body).

Table16.1.Function Structured Exception Handling Rules

Function needs or can:

Frame Function with Frame Pointer Register

Frame Function without Frame Pointer Register

Leaf Function

prologue and epilogue(s)

yes

yes

no

use exception handling

yes

yes

no

allocate space on the stack

yes

yes

no

save or push registers onto the stack

yes

yes

no

use non-volatile registers (after saving)

yes

yes

no

use dynamic stack allocation

yes

no

no

change stack pointer in function body

yes[a]

no

no

unaligned stack pointer in function body

yes[a]

no

yes

make calls to other functions

yes

yes

no

make jumps to other functions

no

no

yes[b]

[a]but 16 byte stack alignment must be re-established when any functions are called.

[b]but the function parameters in registers and on the stack must be compatible.


16.2.3.Frame Function Structure

As already indicated, frame functions must have a well defined structure including a prologue and one or more epilogues, each of a specific form. The code in a function that is not part of its prologue or its one or more epilogues will be referred to here as the function's body.

A typical function prologue has the form:

mov [rsp+8],rcx ; store parameter in shadow space if necessary

push r14 ; save any non-volatile registers to be used

push r13 ;

sub rsp,size ; allocate stack for local variables if needed

lea r13,[bias+rsp] ; use r13 as a frame pointer with an offset

When a frame pointer is needed the programmer can choose which register is used ("bias"will be explained later). Although it does not have to be used for access to the allocated space, it must be assigned in the prologue and remain unchanged during the execution of the body of the function.

If a large amount of stack space is used it is also necessary to call__chkstkwith size in RAX prior to allocating this stack space in order to add memory pages to the stack if needed (see the Microsoft Visual Studio 2005 documentation for further details).

The matching form of the epilogue is:

lea rsp,[r13-bias] ; this is not part of the official epilogue

add rsp,size ; the official epilogue starts here

pop r13

pop r14

ret

The following can also be used provided that a frame pointer register has been established:

lea rsp,[r13+size-bias]

pop r13

pop r14

ret

These are the only two forms of epilogue allowed. It must start either with anadd rsp,constinstruction or withlea rsp,[const+fp_register]; the first form can be used either with or without a frame pointer register but the second form requires one. These instructions are then followed by zero or more 8 byte register pops and a return instruction (which can be replaced with a limited set of jump instructions as described in Microsoft documentation). Epilogue forms are highly restricted because this allows the exception dispatch code to locate them without the need for unwind data in addition to that provided for the prologue.

The data on the location and length of each function prologue, on any fixed stack allocation and on any saved non-volatile registers is recorded in special sections in the object code. Yasm provides macros to create this data that will now be described (with examples of the way they are used).

16.2.4.Stack Frame Details

There are two types of stack frame that need to be considered in creating unwind data.

The first, shown at left inFigure16.2, involves only a fixed allocation of space on the stack and results in a stack pointer that remains fixed in value within the function's body except during calls to other functions. In this type of stack frame the stack pointer value at the end of the prologue is used as the base for the offsets in the unwind primitives and macros described later. It must be 16 byte aligned at this point.

Figure16.2.x64 Detailed Stack Frame



In the second type of frame, shown inFigure16.2, stack space is dynamically allocated with the result that the stack pointer value is statically unpredictable and cannot be used as a base for unwind offsets. In this situation a frame pointer register must be used to provide this base address. Here the base for unwind offsets is the lower end of the fixed allocation area on the stack, which is typically the value of the stack pointer when the frame register is assigned. It must be 16 byte aligned and must be assigned before any unwind macros with offsets are used.

In order to allow the maximum amount of data to be accessed with single byte offsets (-128 to +127) from the frame pointer register, it is normal to offset its value towards the centre of the allocated area (the"bias"introduced earlier). The identity of the frame pointer register and this offset, which must be a multiple of 16 bytes, is recorded in the unwind data to allow the stack frame base address to be calculated from the value in the frame register.

16.2.5.Yasm Primitives for Unwind Operations

Here are the low level facilities Yasm provides to create unwind data.

proc_framename

Generates a function table entry in.pdataand unwind information in.xdatafor a function's structured exception handling data.

[pushregreg]

Generates unwind data for the specified non-volatile register. Use only for non-volatile integer registers; for volatile registers use an[allocstack 8]instead.

[setframereg,offset]

Generates unwind data for a frame register and its stack offset. The offset must be a multiple of 16 and be less than or equal to 240.

[allocstacksize]

Generates unwind data for stack space. The size must be a multiple of 8.

[saveregreg,offset]

Generates unwind data for the specified register and offset; the offset must be positive multiple of 8 relative to the base of the procedure's frame.

[savexmm128reg,offset]

Generates unwind data for the specified XMM register and offset; the offset must be positive multiple of 16 relative to the base of the procedure's frame.

[pushframecode]

Generates unwind data for a 40 or 48 byte (with an optional error code) frame used to store the result of a hardware exception or interrupt.

[endprolog]

Signals the end of the prologue; must be in the first 255 bytes of the function.

endproc_frame

Used at the end of functions started withproc_frame.

Example16.1shows how these primitives are used (this is based on an example provided in Microsoft Visual Studio 2005 documentation).

Example16.1.Win64 Unwind Primitives

PROC_FRAME sample

db 0x48 ; emit a REX prefix to enable hot-patching

push rbp ; save prospective frame pointer

[pushreg rbp] ; create unwind data for this rbp register push

sub rsp,0x40 ; allocate stack space

[allocstack 0x40] ; create unwind data for this stack allocation

lea rbp,[rsp+0x20] ; assign the frame pointer with a bias of 32

[setframe rbp,0x20] ; create unwind data for a frame register in rbp

movdqa [rbp],xmm7 ; save a non-volatile XMM register

[savexmm128 xmm7, 0x20] ; create unwind data for an XMM register save

mov [rbp+0x18],rsi ; save rsi

[savereg rsi,0x38] ; create unwind data for a save of rsi

mov [rsp+0x10],rdi ; save rdi

[savereg rdi, 0x10] ; create unwind data for a save of rdi

[endprolog]


; We can change the stack pointer outside of the prologue because we

; have a frame pointer. If we didn't have one this would be illegal.

; A frame pointer is needed because of this stack pointer modification.


sub rsp,0x60 ; we are free to modify the stack pointer

mov rax,0 ; we can unwind this access violation

mov rax,[rax]


movdqa xmm7,[rbp] ; restore the registers that weren't saved

mov rsi,[rbp+0x18] ; with a push; this is not part of the

mov rdi,[rbp-0x10] ; official epilog


lea rsp,[rbp+0x20] ; This is the official epilog

pop rbp

ret

ENDPROC_FRAME


16.2.6.Yasm Macros for Formal Stack Operations

From the descriptions of the YASM primitives given earlier it can be seen that there is a close relationship between each normal stack operation and the related primitive needed to generate its unwind data. In consequence it is sensible to provide a set of macros that perform both operations in a single macro call. Yasm provides the following macros that combine the two operations.

proc_framename

Generates a function table entry in.pdataand unwind information in.xdata.

alloc_stackn

Allocates a stack area ofnbytes.

save_regreg,loc

Saves a non-volatile registerregat offsetlocon the stack.

push_regreg

Pushes a non-volatile registerregon the stack.

rex_push_regreg

Pushes a non-volatile registerregon the stack using a 2 byte push instruction.

save_xmm128reg,loc

Saves a non-volatile XMM registerregat offsetlocon the stack.

set_framereg,loc

Sets the frame registerregto offsetlocon the stack.

push_eflags

Pushes the eflags register

push_rex_eflags

Pushes the eflags register using a 2 byte push instruction (allows hot patching).

push_framecode

Pushes a 40 byte frame and an optional 8 byte error code onto the stack.

end_prologue,end_prolog

Ends the function prologue (this is an alternative to[endprolog]).

endproc_frame

Used at the end of funtions started withproc_frame.

Example16.2isExample16.1using these higher level macros.

Example16.2.Win64 Unwind Macros

PROC_FRAME sample ; start the prologue

rex_push_reg rbp ; push the prospective frame pointer

alloc_stack 0x40 ; allocate 64 bytes of local stack space

set_frame rbp, 0x20 ; set a frame register to [rsp+32]

save_xmm128 xmm7,0x20 ; save xmm7, rsi &amp; rdi to the local stack space

save_reg rsi, 0x38 ; unwind base address: [rsp_after_entry - 72]

save_reg rdi, 0x10 ; frame register value: [rsp_after_entry - 40]

END_PROLOGUE

sub rsp,0x60 ; we can now change the stack pointer

mov rax,0 ; and unwind this access violation

mov rax,[rax] ; because we have a frame pointer


movdqa xmm7,[rbp] ; restore the registers that weren't saved with

mov rsi,[rbp+0x18] ; a push (not a part of the official epilog)

mov rdi,[rbp-0x10]


lea rsp,[rbp+0x20] ; the official epilogue

pop rbp

ret

ENDPROC_FRAME


Chapter17.xdf: Extended Dynamic Object Format

PartV.Debugging Formats

The chapters in this part of the book document Yasm's support for various debugging formats.

Chapter18.cv8: CodeView Debugging Format for VC8

Chapter19.dwarf2: DWARF2 Debugging Format

Chapter20.stabs: Stabs Debugging Format

PartVI.Architectures

The chapters in this part of the book document Yasm's support for various instruction set architectures.

Chapter21.x86 Architecture

Thex86 architecture is the generic name for a multi-vendor 16-bit, 32-bit, and most recently 64-bit architecture. It was originally developed by Intel in the 8086 series of CPU, extended to 32-bit by Intel in the 80386 CPU, and extended by AMD to 64 bits in the Opteron and Athlon 64 CPU lines. While as of 2007, Intel and AMD are the highest volume manufacturers of x86 CPUs, many other vendors have also manufactured x86 CPUs. Generally the manufacturers have cross-licensed (or copied) major improvements to the architecture, but there are some unique features present in many of the implementations.

21.1.Instructions

The x86 architecture has a variable instruction size that allows for moderate code compression while also allowing for very complex operand combinations as well as a very large instruction set size with many extensions. Instructions generally vary from zero to three operands with only a single memory operand allowed.

21.1.1.NOP Padding

Different processors have different recommendations for theNOP (no operation) instructions used forpadding in code. Padding is commonly performed to align loop boundaries to maximize performance, and it is key that the padding itself add minimal overhead. While the one-byte NOP90his standard across all x86 implementations, more recent generations of processors recommend different variations for longer padding sequences for optimal performance. Most processors that claim a 686 (e.g. Pentium Pro) generation or newer featureset support the"long"NOP opcode0Fh 1Fh, although this opcode was undocumented until recently. Older processors that do not support these dedicated long NOP opcodes generally recommended alternative longer NOP sequences; while these sequences work as NOPs, they can cause decoding inefficiencies on newer processors.

Because of the various NOP recommendations, the code generated by the YasmALIGNdirective depends on both the execution mode (BITS) setting and the processor selected by theCPUdirective (seeSection21.2.1).Table21.1lists the various combinations of generated NOPs.

Table21.1.x86 NOP Padding Modes

BITS

CPU

Padding

16

Any

16-bit short NOPs

32

None given, or less than686

32-bit short NOPs (no long NOPs)

32

686or newer Intel processor

Intel guidelines, using long NOPs

32

K6or newer AMD processor

AMD K10 guidelines, using long NOPs

64

None

Intel guidelines, using long NOPs

64

686or newer Intel processor

Intel guidelines, using long NOPs

64

K6or newer AMD processor

AMD K10 guidelines, using long NOPs


In addition, the above defaults may be overridden by passing one of the options inTable21.2to theCPUdirective.

Table21.2.x86 NOPCPUDirective Options

Name

Description

basicnop

Long NOPs not used

intelnop

Intel guidelines, using long NOPs

amdnop

AMD K10 guidelines, using long NOPs


21.2.Execution Modes and Extensions

The x86 has been extended in many ways throughout its history, remaining mostly backwards compatible while adding execution modes and large extensions to the instruction set. A modern x86 processor can operate in one of four major modes: 16-bit real mode, 16-bit protected mode, 32-bit protected mode, and 64-bit long mode. The primary difference between real and protected mode is in the handling of segments: in real mode the segments directly address memory as 16-byte pages, whereas in protected mode the segments are instead indexes into a descriptor table that contains the physical base and size of the segment. 32-bit protected mode allows paging and virtual memory as well as a 32-bit rather than a 16-bit offset.

The 16-bit and 32-bit operating modes both allow for use of both 16-bit and 32-bit registers via instruction prefixes that set the operation and address size to either 16-bit or 32-bit, with the active operating mode setting the default operation size and the"other"size being flagged with a prefix. These operation and address sizes also affect the size of immediate operands: for example, an instruction with a 32-bit operation size with an immediate operand will have a 32-bit value in the encoded instruction, excepting optimizations such as sign-extended 8-bit values.

Unlike the 16-bit and 32-bit modes, 64-bit long mode is more of a break from the"legacy"modes. Long mode obsoletes several instructions. It is also the only mode in which 64-bit registers are available; 64-bit registers cannot be accessed from either 16-bit or 32-bit mode. Also, unlike the other modes, most encoded values in long mode are limited to 32 bits in size. A small subset of theMOVinstructions allow 64 bit encoded values, but values greater than 32 bits in other instructions must come from a register. Partly due to this limitation, but also due to the wide use of relocatable shared libraries, long mode also adds a new addressing mode:RIP-relative.

21.2.1.CPU Options

The NASM parser allows setting what subsets of instructions and operands are accepted by Yasm via use of theCPUdirective (seeSection5.8). As the x86 architecture has a very large number of extensions, both specific feature flags such as"SSE3"and CPU names such as"P4"can be specified. The feature flags have both normal and"no"-prefixed versions to turn on and off a single feature, while the CPU names turn on only the features listed, turning off all other features.Table21.3lists the feature flags, andTable21.4lists the CPU names Yasm supports. Having both feature flags and CPU names allows for combinations such asCPU P3 nofpu. Both feature flags and CPU names are case insensitive.

Table21.3.x86 CPU Feature Flags

Name

Description

FPU

Floating Point Unit (FPU) instructions

MMX

MMX SIMD instructions

SSE

Streaming SIMD Extensions (SSE) instructions

SSE2

Streaming SIMD Extensions 2 instructions

SSE3

Streaming SIMD Extensions 3 instructions

SSSE3

Supplemental Streaming SIMD Extensions 3 instructions

SSE4.1

Streaming SIMD Extensions 4, Penryn subset (47 instructions)

SSE4.2

Streaming SIMD Extensions 4, Nehalem subset (7 instructions)

SSE4

All Streaming SIMD Extensions 4 instructions (both SSE4.1 and SSE4.2)

SSE4a

Streaming SIMD Extensions 4a (AMD)

SSE5

Streaming SIMD Extensions 5

XSAVE

XSAVE instructions

AVX

Advanced Vector Extensions instructions

FMA

Fused Multiply-Add instructions

AES

Advanced Encryption Standard instructions

CLMUL,PCLMULQDQ

PCLMULQDQ instruction

3DNow

3DNow! instructions

Cyrix

Cyrix-specific instructions

AMD

AMD-specific instructions (older than K6)

SMM

System Management Mode instructions

Prot,Protected

Protected mode only instructions

Undoc,Undocumented

Undocumented instructions

Obs,Obsolete

Obsolete instructions

Priv,Privileged

Privileged instructions

SVM

Secure Virtual Machine instructions

PadLock

VIA PadLock instructions

EM64T

Intel EM64T or better instructions (not necessarily 64-bit only)


Table21.4.x86 CPU Names

Name

Feature Flags

Description

8086

Priv

Intel 8086

186,80186,i186

Priv

Intel 80186

286,80286,i286

Priv

Intel 80286

386,80386,i386

SMM,Prot,Priv

Intel 80386

486,80486,i486

FPU,SMM,Prot,Priv

Intel 80486

586,i586,Pentium,P5

FPU,SMM,Prot,Priv

Intel Pentium

686,i686,P6,PPro,PentiumPro

FPU,SMM,Prot,Priv

Intel Pentium Pro

P2,Pentium2,Pentium-2,PentiumII,Pentium-II

MMX,FPU,SMM,Prot,Priv

Intel Pentium II

P3,Pentium3,Pentium-3,PentiumIII,Pentium-III,Katmai

SSE,MMX,FPU,SMM,Prot,Priv

Intel Pentium III

P4,Pentium4,Pentium-4,PentiumIV,Pentium-IV,Williamette

SSE2,SSE,MMX,FPU,SMM,Prot,Priv

Intel Pentium 4

IA64,IA-64,Itanium

SSE2,SSE,MMX,FPU,SMM,Prot,Priv

Intel Itanium (x86)

K6

3DNow,MMX,FPU,SMM,Prot,Priv

AMD K6

Athlon,K7

SSE,3DNow,MMX,FPU,SMM,Prot,Priv

AMD Athlon

Hammer,Clawhammer,Opteron,Athlon64,Athlon-64

SSE2,SSE,3DNow,MMX,FPU,SMM,Prot,Priv

AMD Athlon64 and Opteron

Prescott

SSE3,SSE2,SSEMMX,FPU,SMM,Prot,Priv

Intel codename Prescott

Conroe,Core2

SSSE3,SSE3,SSE2,SSE,MMX,FPU,SMM,Prot,Priv

Intel codename Conroe

Penryn

SSE4.1,SSSE3,SSE3,SSE2,SSE,MMX,FPU,SMM,Prot,Priv

Intel codename Penryn

Nehalem,Corei7

XSAVE,SSE4.2,SSE4.1,SSSE3,SSE3,SSE2,SSE,MMX,FPU,SMM,Prot,Priv

Intel codename Nehalem

Westmere

CLMUL,AES,XSAVE,SSE4.2,SSE4.1,SSSE3,SSE3,SSE2,SSE,MMX,FPU,SMM,Prot,Priv

Intel codename Westmere

Sandybridge

AVX,CLMUL,AES,XSAVE,SSE4.2,SSE4.1,SSSE3,SSE3,SSE2,SSE,MMX,FPU,SMM,Prot,Priv

Intel codename Sandy Bridge

Venice

SSE3,SSE2,SSE,3DNow,MMX,FPU,SMM,Prot,Priv

AMD codename Venice

K10,Phenom,Family10h

SSE4a,SSE3,SSE2,SSE,3DNow,MMX,FPU,SMM,Prot,Priv

AMD codename K10

Bulldozer

SSE5,SSE4a,SSE3,SSE2,SSE,3DNow,MMX,FPU,SMM,Prot,Priv

AMD codename Bulldozer


In order to have access to 64-bit instructions,botha 64-bit capable CPU must be selected, and 64-bit assembly mode must be set (in NASM syntax) by either usingBITS 64(seeSection5.1) or targetting a 64-bit object format such aself64.

The default CPU setting is for the latest processor and all feature flags to be enabled; e.g. all x86 instructions for any processor, including all instruction set extensions and 64-bit instructions.

21.3.Registers

The 64-bit x86 register set consists of 16 general purpose registers, only 8 of which are available in 16-bit and 32-bit mode. The core eight 16-bit registers areAX,BX,CX,DX,SI,DI,BP, andSP. The least significant 8 bits of the first four of these registers are accessible via theAL,BL,CL, andDLin all execution modes. In 64-bit mode, the least significant 8 bits of the other four of these registers are also accessible; these are namedSIL,DIL,SPL, andBPL. The most significant 8 bits of the first four 16-bit registers are also available, although there are some restrictions on when they can be used in 64-bit mode; these are namedAH,BH,CH, andDH.

The 80386 extended these registers to 32 bits while retaining all of the 16-bit and 8-bit names that were available in 16-bit mode. The new extended registers are denoted by adding aEprefix; thus the core eight 32-bit registers are namedEAX,EBX,ECX,EDX,ESI,EDI,EBP, andESP. The original 8-bit and 16-bit register names map into the least significant portion of the 32-bit registers.

64-bit long mode further extended these registers to 64 bits in size by adding aRprefix to the 16-bit name; thus the base eight 64-bit registers are namedRAX,RBX, etc. Long mode also added eight extra registers named numericallyr8throughr15. The least significant 32 bits of these registers are available via adsuffix (r8dthroughr15d), the least significant 16 bits via awsuffix (r8wthroughr15w), and the least significant 8 bits via absuffix (r8bthroughr15b).

Figure21.1summarizes the full 64-bit x86 general purpose register set.

Figure21.1.x86 General Purpose Registers



21.4.Segmentation

Index

Symbols

!=,%if: Testing Arbitrary Numeric Expressions

$

here,Expressions

prefix,Layout of a NASM Source Line,Numeric Constants

$$,Expressions,elf32 Special Symbols and WRT

% operator,*, /, //, % and %%: Multiplication and Division

%$,Context-Local Labels

%$$,Context-Local Labels

%%,Macro-Local Labels

%% operator,*, /, //, % and %%: Multiplication and Division

%+,Concatenating Single Line Macro Tokens: %+

%+1,Condition Codes as Macro Parameters

%-1,Condition Codes as Macro Parameters

%0,Default Macro Parameters,%0: Macro Parameter Counter

%assign,Preprocessor Variables: %assign

%clear,Standard Macros

%define,The Normal Way: %define

%elif,Conditional Assembly,%if: Testing Arbitrary Numeric Expressions

%elifctx,%ifctx: Testing the Context Stack

%elifdef,%ifdef: Testing Single-Line Macro Existence

%elifid,%ifid, %ifnum, %ifstr: Testing Token Types

%elifidn,%ifidn and %ifidni: Testing Exact Text Identity

%elifidni,%ifidn and %ifidni: Testing Exact Text Identity

%elifmacro,%ifmacro: Testing Multi-Line Macro Existence

%elifnctx,%ifctx: Testing the Context Stack

%elifndef,%ifdef: Testing Single-Line Macro Existence

%elifnid,%ifid, %ifnum, %ifstr: Testing Token Types

%elifnidn,%ifidn and %ifidni: Testing Exact Text Identity

%elifnidni,%ifidn and %ifidni: Testing Exact Text Identity

%elifnmacro,%ifmacro: Testing Multi-Line Macro Existence

%elifnnum,%ifid, %ifnum, %ifstr: Testing Token Types

%elifnstr,%ifid, %ifnum, %ifstr: Testing Token Types

%elifnum,%ifid, %ifnum, %ifstr: Testing Token Types

%elifstr,%ifid, %ifnum, %ifstr: Testing Token Types

%else,Conditional Assembly

%endrep,Preprocessor Loops

%error,%error: Reporting User-Defined Errors

%exitrep,Preprocessor Loops

%iassign,Preprocessor Variables: %assign

%idefine,The Normal Way: %define

%if,Conditional Assembly,%if: Testing Arbitrary Numeric Expressions

%ifctx,%ifctx: Testing the Context Stack,Example Use of the Context Stack: Block IFs

%ifdef,%ifdef: Testing Single-Line Macro Existence

%ifid,%ifid, %ifnum, %ifstr: Testing Token Types

%ifidn,%ifidn and %ifidni: Testing Exact Text Identity

%ifidni,%ifidn and %ifidni: Testing Exact Text Identity

%ifmacro,%ifmacro: Testing Multi-Line Macro Existence

%ifnctx,%ifctx: Testing the Context Stack

%ifndef,%ifdef: Testing Single-Line Macro Existence

%ifnid,%ifid, %ifnum, %ifstr: Testing Token Types

%ifnidn,%ifidn and %ifidni: Testing Exact Text Identity

%ifnidni,%ifidn and %ifidni: Testing Exact Text Identity

%ifnmacro,%ifmacro: Testing Multi-Line Macro Existence

%ifnnum,%ifid, %ifnum, %ifstr: Testing Token Types

%ifnstr,%ifid, %ifnum, %ifstr: Testing Token Types

%ifnum,%ifid, %ifnum, %ifstr: Testing Token Types

%ifstr,%ifid, %ifnum, %ifstr: Testing Token Types

%imacro,Multi-Line Macros

%include,Including Other Files

%macro,Multi-Line Macros

%pop,The Context Stack,%push and %pop: Creating and Removing Contexts

%push,The Context Stack,%push and %pop: Creating and Removing Contexts

%rep,TIMES: Repeating Instructions or Data,Preprocessor Loops

%repl,%repl: Renaming a Context

%rotate,%rotate: Rotating Macro Parameters

%strlen,String Length: %strlen

%substr,Sub-strings: %substr

%undef,Undefining macros: %undef

%xdefine,Enhancing %define: %xdefine

%xidefine,Enhancing %define: %xdefine

& operator,&: Bitwise AND Operator

&&,%if: Testing Arbitrary Numeric Expressions

* operator,*, /, //, % and %%: Multiplication and Division

+ modifier,Greedy Macro Parameters

+ operator

binary,+ and -: Addition and Subtraction Operators

unary,Unary Operators: +, -, ~ and SEG

- operator

binary,+ and -: Addition and Subtraction Operators

unary,Unary Operators: +, -, ~ and SEG

--mapfile,Map Files

-f,__YASM_OBJFMT__ and __OUTPUT_FORMAT__: Output Object Format Keyword

-P,Including Other Files

..@,Macro-Local Labels

..@ symbol prefix,Local Labels

..got,elf32 Special Symbols and WRT,elf64 Special Symbols and WRT,elfx32 Special Symbols and WRT

..gotoff,elf32 Special Symbols and WRT

..gotpc,elf32 Special Symbols and WRT

..gotpcrel,elf64 Special Symbols and WRT,elfx32 Special Symbols and WRT

..plt,elf32 Special Symbols and WRT,elf64 Special Symbols and WRT,elfx32 Special Symbols and WRT

..sym,elf32 Special Symbols and WRT,elf64 Special Symbols and WRT,elfx32 Special Symbols and WRT

.COM,bin: Flat-Form Binary Output

.comment,IDENT: Add file identification

.drectve,win32 Extensions to the SECTION Directive

.nolist,Disabling Listing Expansion

.obj,win32: Microsoft Win32 Object Files

.pdata,win64 Structured Exception Handling

.SYS,bin: Flat-Form Binary Output

.xdata,win64 Structured Exception Handling

/ operator,*, /, //, % and %%: Multiplication and Division

// operator,*, /, //, % and %%: Multiplication and Division

16-bit mode

versus 32-bit mode,BITS

32-bit,win32: Microsoft Win32 Object Files

32-bit mode

versus 64-bit mode,BITS

32-bit shared libraries,elf32 Special Symbols and WRT

64-bit,elf64: Executable and Linkable Format 64-bit Object Files,win64: PE32+ (Microsoft Win64) Object Files

64-bit shared libraries,elf64 Special Symbols and WRT

<,%if: Testing Arbitrary Numeric Expressions

<< operator,<< and >>: Bit Shift Operators

<=,%if: Testing Arbitrary Numeric Expressions

<>,%if: Testing Arbitrary Numeric Expressions

=,%if: Testing Arbitrary Numeric Expressions

==,%if: Testing Arbitrary Numeric Expressions

>,%if: Testing Arbitrary Numeric Expressions

>=,%if: Testing Arbitrary Numeric Expressions

>> operator,<< and >>: Bit Shift Operators

?,RESB and Friends: Declaring Uninitialized Data

[MAP],Map Files

^ operator,^: Bitwise XOR Operator

^^,%if: Testing Arbitrary Numeric Expressions

__FILE__,__FILE__ and __LINE__: File Name and Line Number

__LINE__,__FILE__ and __LINE__: File Name and Line Number

__OUTPUT_FORMAT__,__YASM_OBJFMT__ and __OUTPUT_FORMAT__: Output Object Format Keyword

__SECT__,The __SECT__ Macro,ABSOLUTE: Defining Absolute Labels

__YASM_BUILD__,__YASM_MAJOR__, etc: Yasm Version

__YASM_MAJOR__,__YASM_MAJOR__, etc: Yasm Version

__YASM_MINOR__,__YASM_MAJOR__, etc: Yasm Version

__YASM_OBJFMT__,__YASM_OBJFMT__ and __OUTPUT_FORMAT__: Output Object Format Keyword

__YASM_SUBMINOR__,__YASM_MAJOR__, etc: Yasm Version

__YASM_VERSION_ID__,__YASM_MAJOR__, etc: Yasm Version

__YASM_VER__,__YASM_MAJOR__, etc: Yasm Version

| operator,|: Bitwise OR Operator

||,%if: Testing Arbitrary Numeric Expressions

~ operator,Unary Operators: +, -, ~ and SEG

A

ABS,RIP Relative Addressing,DEFAULT: Change the assembler defaults

ABSOLUTE,ABSOLUTE: Defining Absolute Labels

addition,+ and -: Addition and Subtraction Operators

address-size prefixes,Layout of a NASM Source Line

after % sign,Concatenating Macro Parameters

algebra,Effective Addresses

ALIGN,ALIGN and ALIGNB: Data Alignment,bin Extensions to the SECTION Directive

code,NOP Padding

ALIGNB,ALIGN and ALIGNB: Data Alignment

alignment

code,NOP Padding

in win32 sections,win32 Extensions to the SECTION Directive

of common variables,ELF Extensions to the COMMON Directive

alignment in elf,ELF Extensions to the COMMON Directive

amd64,elf64: Executable and Linkable Format 64-bit Object Files,elfx32: ELF 32-bit Object Files for 64-bit Processors,x86 Architecture

amdnop,NOP Padding

arbitrary numeric expressions,%if: Testing Arbitrary Numeric Expressions

around macro parameters,Multi-Line Macros

Assembler Directives,NASM Assembler Directives

assembly passes,Critical Expressions

AT,ISTRUC, AT and IEND: Declaring Instances of Structures

B

basicnop,NOP Padding

bin,bin: Flat-Form Binary Output

binary,Numeric Constants,+ and -: Addition and Subtraction Operators

Binary Files,INCBIN: Including External Binary Files

Binary origin,ORG: Binary Origin

Bit Shift,<< and >>: Bit Shift Operators

BITS,BITS

bitwise AND,&: Bitwise AND Operator

bitwise OR,|: Bitwise OR Operator

bitwise XOR,^: Bitwise XOR Operator

Block IFs,Example Use of the Context Stack: Block IFs

braces

after % sign,Concatenating Macro Parameters

around macro parameters,Multi-Line Macros

C

CALL FAR,SEG and WRT

case sensitive,The Normal Way: %define,Enhancing %define: %xdefine,Preprocessor Variables: %assign

case-insensitive,%ifidn and %ifidni: Testing Exact Text Identity

case-sensitive,Multi-Line Macros

changing sections,Changing and Defining Sections

character constant,DB and Friends: Declaring Initialized Data

Character Constants,Character Constants

circular references,The Normal Way: %define

code,NOP Padding

CodeView,cv8: CodeView Debugging Format for VC8

coff,coff: Common Object File Format

COFF

debugging,stabs: Stabs Debugging Format

colon,Layout of a NASM Source Line

COMMON,COMMON: Defining Common Data Areas

Common Object File Format,coff: Common Object File Format

common variables,COMMON: Defining Common Data Areas

alignment in elf,ELF Extensions to the COMMON Directive

Concatenating Macro Parameters,Concatenating Macro Parameters

Condition Codes as Macro Parameters,Condition Codes as Macro Parameters

Conditional Assembly,Conditional Assembly

conditional-return macro,Condition Codes as Macro Parameters

Constants,Constants

constants,Floating-Point Constants

context stack,%ifctx: Testing the Context Stack

Context Stack,The Context Stack,Example Use of the Context Stack: Block IFs

Context-Local Labels,Context-Local Labels

Context-Local Single-Line Macros,Context-Local Single-Line Macros

counting macro parameters,%0: Macro Parameter Counter

CPU,CPU: Defining CPU Dependencies

CPUID,Character Constants

creating contexts,%push and %pop: Creating and Removing Contexts

critical expression,RESB and Friends: Declaring Uninitialized Data,EQU: Defining Constants,Preprocessor Variables: %assign,ABSOLUTE: Defining Absolute Labels

Critical Expressions,Critical Expressions

cv8,cv8: CodeView Debugging Format for VC8

D

data,ELF Extensions to the GLOBAL Directive

DB,DB and Friends: Declaring Initialized Data,String Constants

DD,DB and Friends: Declaring Initialized Data,String Constants,Floating-Point Constants

DDQ,DB and Friends: Declaring Initialized Data

DDQWORD,Layout of a NASM Source Line

debugging,dwarf2: DWARF2 Debugging Format,stabs: Stabs Debugging Format

Declaring Structure,STRUC and ENDSTRUC: Declaring Structure Data Types

DEFAULT,RIP Relative Addressing,DEFAULT: Change the assembler defaults

default,ELF Extensions to the GLOBAL Directive

Default Macro Parameters,Default Macro Parameters

Defining Sections,Changing and Defining Sections

directives,ELF Directives

Disabling Listing Expansion,Disabling Listing Expansion

division,*, /, //, % and %%: Multiplication and Division

DO,DB and Friends: Declaring Initialized Data

DQ,DB and Friends: Declaring Initialized Data,String Constants,Floating-Point Constants

DT,DB and Friends: Declaring Initialized Data,Floating-Point Constants

DUP,TIMES: Repeating Instructions or Data

DW,DB and Friends: Declaring Initialized Data,String Constants,Floating-Point Constants

DWARF,dwarf2: DWARF2 Debugging Format

dwarf2,dwarf2: DWARF2 Debugging Format

DWORD,Layout of a NASM Source Line

E

effective address,Effective Addresses

effective addresses,Layout of a NASM Source Line

effective-address,Critical Expressions

elf,elf32: Executable and Linkable Format 32-bit Object Files,elf64: Executable and Linkable Format 64-bit Object Files

directives,ELF Directives

elf32,elf32: Executable and Linkable Format 32-bit Object Files

elf64,elf64: Executable and Linkable Format 64-bit Object Files

elfx32,elfx32: ELF 32-bit Object Files for 64-bit Processors

SECTION,ELF Sections

symbol size,SIZE: Set symbol size

symbol type,TYPE: Set symbol type

weak reference,WEAK: Create weak symbol

ELF

32-bit shared libraries,elf32 Special Symbols and WRT

64-bit shared libraries,elf64 Special Symbols and WRT

debugging,dwarf2: DWARF2 Debugging Format,stabs: Stabs Debugging Format

x32 shared libraries,elfx32 Special Symbols and WRT

elf32,elf32: Executable and Linkable Format 32-bit Object Files

elf64,elf64: Executable and Linkable Format 64-bit Object Files

elfx32,elfx32: ELF 32-bit Object Files for 64-bit Processors

ENDSTRUC,STRUC and ENDSTRUC: Declaring Structure Data Types,ABSOLUTE: Defining Absolute Labels

EQU,EQU: Defining Constants,Critical Expressions

exact text identity,%ifidn and %ifidni: Testing Exact Text Identity

Executable and Linkable Format,elf32: Executable and Linkable Format 32-bit Object Files

64-bit,elf64: Executable and Linkable Format 64-bit Object Files

x32,elfx32: ELF 32-bit Object Files for 64-bit Processors

Exporting Symbols,GLOBAL: Exporting Symbols

Expressions,Expressions

Extended Dynamic Object,xdf: Extended Dynamic Object Format

EXTERN,EXTERN: Importing Symbols

F

far pointer,SEG and WRT

Flash,bin: Flat-Form Binary Output

Flat-Form Binary,bin: Flat-Form Binary Output

floating-point,Layout of a NASM Source Line,DB and Friends: Declaring Initialized Data

constants,Floating-Point Constants

FOLLOWS,bin Extensions to the SECTION Directive

format-specific directives,NASM Assembler Directives

forward references,Critical Expressions

FreeBSD,elf32: Executable and Linkable Format 32-bit Object Files

function,TYPE: Set symbol type,ELF Extensions to the GLOBAL Directive

G

gdb,dwarf2: DWARF2 Debugging Format,stabs: Stabs Debugging Format

GLOBAL,GLOBAL: Exporting Symbols,ELF Extensions to the GLOBAL Directive

global offset table,elf32 Special Symbols and WRT

GOT,elf32 Special Symbols and WRT,elf64 Special Symbols and WRT,elfx32 Special Symbols and WRT

graphics,INCBIN: Including External Binary Files

Greedy Macro Parameters,Greedy Macro Parameters

groups,SEG and WRT

H

here,Expressions

hex,Numeric Constants

hidden,ELF Extensions to the GLOBAL Directive

I

IDENT,IDENT: Add file identification

IEND,ISTRUC, AT and IEND: Declaring Instances of Structures

Immediates,Immediate Operands

Importing Symbols,EXTERN: Importing Symbols

in win32,win32 Extensions to the SECTION Directive

in win32 sections,win32 Extensions to the SECTION Directive

INCBIN,INCBIN: Including External Binary Files,String Constants

Including Other Files,Including Other Files

infinite loop,Expressions

informational section,win32 Extensions to the SECTION Directive

Initialized,DB and Friends: Declaring Initialized Data

Instances of Structures,ISTRUC, AT and IEND: Declaring Instances of Structures

Intel number formats,Floating-Point Constants

intelnop,NOP Padding

internal,ELF Extensions to the GLOBAL Directive

ISTRUC,ISTRUC, AT and IEND: Declaring Instances of Structures

iterating over macro parameters,%rotate: Rotating Macro Parameters

L

label prefix,Local Labels

library,WEAK: Create weak symbol

Linux

elf,elf32: Executable and Linkable Format 32-bit Object Files,elf64: Executable and Linkable Format 64-bit Object Files

x32,elfx32: ELF 32-bit Object Files for 64-bit Processors

little-endian,Character Constants

LMA,bin Extensions to the SECTION Directive

Local Labels,Local Labels

logical AND,%if: Testing Arbitrary Numeric Expressions

logical OR,%if: Testing Arbitrary Numeric Expressions

logical XOR,%if: Testing Arbitrary Numeric Expressions

M

Mac OSX,macho32: Mach 32-bit Object File Format,macho64: Mach 64-bit Object File Format

Mach-O,macho32: Mach 32-bit Object File Format,macho64: Mach 64-bit Object File Format

macho

macho32,macho32: Mach 32-bit Object File Format

macho64,macho64: Mach 64-bit Object File Format

macho32,macho32: Mach 32-bit Object File Format

macho64,macho64: Mach 64-bit Object File Format

macro processor,The NASM Preprocessor

Macro-Local Labels,Macro-Local Labels

macros,TIMES: Repeating Instructions or Data

Map file,Map Files

memory reference,Effective Addresses

Microsoft Visual Studio 2010,VSYASM - Yasm for Microsoft Visual Studio 2010

modulo operators,*, /, //, % and %%: Multiplication and Division

MSBUILD,VSYASM - Yasm for Microsoft Visual Studio 2010

multi-line macro existence,%ifmacro: Testing Multi-Line Macro Existence

Multi-Line Macros,Multi-Line Macros

multi-line macros,Overloading Multi-Line Macros

multiplication,*, /, //, % and %%: Multiplication and Division

multipush,%rotate: Rotating Macro Parameters

N

NOP,NOP Padding

NOSPLIT,Effective Addresses

numeric constant,DB and Friends: Declaring Initialized Data

Numeric Constants,Numeric Constants

O

object,TYPE: Set symbol type

octal,Numeric Constants

of common variables,ELF Extensions to the COMMON Directive

of symbols,SIZE: Set symbol size,TYPE: Set symbol type,ELF Extensions to the GLOBAL Directive

omitted parameters,Default Macro Parameters

one's complement,Unary Operators: +, -, ~ and SEG

operand-size prefixes,Layout of a NASM Source Line

operands,Layout of a NASM Source Line

operators,Expressions

ORG,ORG: Binary Origin

Origin,ORG: Binary Origin

orphan-labels,Layout of a NASM Source Line

overlapping segments,SEG and WRT

overloading

multi-line macros,Overloading Multi-Line Macros

single-line macros,The Normal Way: %define

OWORD,Layout of a NASM Source Line

P

padding,NOP Padding

paradox,Critical Expressions

passes,Critical Expressions

PE,win32: Microsoft Win32 Object Files

PE32+,win64: PE32+ (Microsoft Win64) Object Files

period,Local Labels

PIC,elf32 Special Symbols and WRT,elf64 Special Symbols and WRT

PIC-specific,elf32 Special Symbols and WRT,elf64 Special Symbols and WRT,elfx32 Special Symbols and WRT

PLT,elf32 Special Symbols and WRT,elf64 Special Symbols and WRT,elfx32 Special Symbols and WRT

Position-Independent Code,elf32 Special Symbols and WRT,elf64 Special Symbols and WRT,elfx32 Special Symbols and WRT

pre-define,The Normal Way: %define

precedence,Expressions

preferred,SEG and WRT

prefix,Layout of a NASM Source Line,Numeric Constants

preprocessor,EQU: Defining Constants

Preprocessor Loops,Preprocessor Loops

Preprocessor Variables,Preprocessor Variables: %assign

primitive directives,NASM Assembler Directives

procedure linkage table,elf32 Special Symbols and WRT,elf64 Special Symbols and WRT,elfx32 Special Symbols and WRT

Processor Mode,Specifying Target Processor Mode

protected,ELF Extensions to the GLOBAL Directive

pseudo-instructions,Pseudo-Instructions

PUBLIC,GLOBAL: Exporting Symbols

pure binary,bin: Flat-Form Binary Output

Q

QWORD,Layout of a NASM Source Line

R

rdf,rdf: Relocatable Dynamic Object File Format

RDOFF,rdf: Relocatable Dynamic Object File Format

REL,RIP Relative Addressing,DEFAULT: Change the assembler defaults

relational operators,%if: Testing Arbitrary Numeric Expressions

Relocatable Dynamic Object File Format,rdf: Relocatable Dynamic Object File Format

relocations

PIC-specific,elf32 Special Symbols and WRT,elf64 Special Symbols and WRT,elfx32 Special Symbols and WRT

removing contexts,%push and %pop: Creating and Removing Contexts

renaming contexts,%repl: Renaming a Context

Repeating,TIMES: Repeating Instructions or Data

repeating code,Preprocessor Loops

RESB,RESB and Friends: Declaring Uninitialized Data,Critical Expressions

RESD,RESB and Friends: Declaring Uninitialized Data

RESDQ,RESB and Friends: Declaring Uninitialized Data

RESO,RESB and Friends: Declaring Uninitialized Data

RESQ,RESB and Friends: Declaring Uninitialized Data

REST,RESB and Friends: Declaring Uninitialized Data

RESW,RESB and Friends: Declaring Uninitialized Data

REX,BITS

RIP,RIP Relative Addressing

Rotating Macro Parameters,%rotate: Rotating Macro Parameters

S

searching for include files,Including Other Files

SECTION,SECTION and SEGMENT,ELF Sections,win32 Extensions to the SECTION Directive

win32 extensions to,win32 Extensions to the SECTION Directive

section alignment

in win32,win32 Extensions to the SECTION Directive

section.length,bin Special Symbols

section.start,bin Special Symbols

section.vstart,bin Special Symbols

SEG,Unary Operators: +, -, ~ and SEG,SEG and WRT

segment address,Unary Operators: +, -, ~ and SEG,SEG and WRT

segment override,Layout of a NASM Source Line

segmentation

x86,Segmentation

segments,SEG and WRT

shift command,%rotate: Rotating Macro Parameters

signed division,*, /, //, % and %%: Multiplication and Division

signed modulo,*, /, //, % and %%: Multiplication and Division

single-line macro existence,%ifdef: Testing Single-Line Macro Existence

Single-line macros,The Normal Way: %define

single-line macros,The Normal Way: %define

size

of symbols,SIZE: Set symbol size,ELF Extensions to the GLOBAL Directive

SIZE,SIZE: Set symbol size

Solaris x86,elf32: Executable and Linkable Format 32-bit Object Files

Solaris x86-64,elf64: Executable and Linkable Format 64-bit Object Files

sound,INCBIN: Including External Binary Files

specifying,SIZE: Set symbol size,TYPE: Set symbol type,ELF Extensions to the GLOBAL Directive

square brackets,Effective Addresses

stabs,stabs: Stabs Debugging Format

Standard Macros,Standard Macros

standard section names,win32 Extensions to the SECTION Directive

standardised section names,Standardized Section Names

STRICT,STRICT: Inhibiting Optimization

string constant,DB and Friends: Declaring Initialized Data

String Constants,String Constants

String Handling in Macros,String Handling in Macros

String Length,String Length: %strlen

STRUC,STRUC and ENDSTRUC: Declaring Structure Data Types,ABSOLUTE: Defining Absolute Labels

structured exceptions,win64 Structured Exception Handling

Sub-strings,Sub-strings: %substr

subtraction,+ and -: Addition and Subtraction Operators

switching between sections,Changing and Defining Sections

symbol size,SIZE: Set symbol size

symbol sizes

specifying,SIZE: Set symbol size,ELF Extensions to the GLOBAL Directive

symbol type,TYPE: Set symbol type

symbol types

specifying,TYPE: Set symbol type,ELF Extensions to the GLOBAL Directive

T

testing

arbitrary numeric expressions,%if: Testing Arbitrary Numeric Expressions

context stack,%ifctx: Testing the Context Stack

exact text identity,%ifidn and %ifidni: Testing Exact Text Identity

multi-line macro existence,%ifmacro: Testing Multi-Line Macro Existence

single-line macro existence,%ifdef: Testing Single-Line Macro Existence

token types,%ifid, %ifnum, %ifstr: Testing Token Types

TIMES,TIMES: Repeating Instructions or Data,Critical Expressions

token types,%ifid, %ifnum, %ifstr: Testing Token Types

two-pass assembler,Critical Expressions

TWORD,Layout of a NASM Source Line

type

of symbols,TYPE: Set symbol type,ELF Extensions to the GLOBAL Directive

TYPE,TYPE: Set symbol type

U

unary,Unary Operators: +, -, ~ and SEG

Unary Operators,Unary Operators: +, -, ~ and SEG

Uninitialized,RESB and Friends: Declaring Uninitialized Data

UnixWare,elf32: Executable and Linkable Format 32-bit Object Files

unrolled loops,TIMES: Repeating Instructions or Data

unsigned division,*, /, //, % and %%: Multiplication and Division

unsigned modulo,*, /, //, % and %%: Multiplication and Division

unwind data,win64 Structured Exception Handling

USE16,USE16, USE32, and USE64

USE32,USE16, USE32, and USE64

USE64,USE16, USE32, and USE64

User-Defined Errors,%error: Reporting User-Defined Errors

user-level assembler directives,Standard Macros

user-level directives,NASM Assembler Directives

V

Valid characters,Layout of a NASM Source Line

VALIGN,bin Extensions to the SECTION Directive

version control,IDENT: Add file identification

version number of Yasm,__YASM_MAJOR__, etc: Yasm Version

versus 32-bit mode,BITS

versus 64-bit mode,BITS

VFOLLOWS,bin Extensions to the SECTION Directive

Vista,win32: Microsoft Win32 Object Files

Vista x64,win64: PE32+ (Microsoft Win64) Object Files

Visual Studio,win32: Microsoft Win32 Object Files,win64: PE32+ (Microsoft Win64) Object Files

Visual Studio 2005,cv8: CodeView Debugging Format for VC8

Visual Studio 2008,cv8: CodeView Debugging Format for VC8

Visual Studio 2010,VSYASM - Yasm for Microsoft Visual Studio 2010

VMA,bin Extensions to the SECTION Directive

VSYASM,VSYASM - Yasm for Microsoft Visual Studio 2010

W

WEAK,WEAK: Create weak symbol

weak reference,WEAK: Create weak symbol

win32,win32: Microsoft Win32 Object Files

SECTION,win32 Extensions to the SECTION Directive

Win32,win32: Microsoft Win32 Object Files

win32 extensions to,win32 Extensions to the SECTION Directive

win64,win64: PE32+ (Microsoft Win64) Object Files

Win64,win64: PE32+ (Microsoft Win64) Object Files

Windows

32-bit,win32: Microsoft Win32 Object Files

64-bit,win64: PE32+ (Microsoft Win64) Object Files

Windows XP,win32: Microsoft Win32 Object Files

Windows XP x64,win64: PE32+ (Microsoft Win64) Object Files

WRT,SEG and WRT,elf32 Special Symbols and WRT,elf64 Special Symbols and WRT

X

x32,elfx32: ELF 32-bit Object Files for 64-bit Processors

x32 shared libraries,elfx32 Special Symbols and WRT

x64,win64: PE32+ (Microsoft Win64) Object Files

structured exceptions,win64 Structured Exception Handling

x86,x86 Architecture,Segmentation

xdf,xdf: Extended Dynamic Object Format

Y

Yasm Version,__YASM_MAJOR__, etc: Yasm Version

SRC=http://www.tortall.net/projects/yasm/manual/html/manual.html

總結

以上是生活随笔為你收集整理的YASM User Manual的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

最近免费中文字幕中文高清百度 | 荫蒂被男人添的好舒服爽免费视频 | 日韩欧美群交p片內射中文 | 一二三四社区在线中文视频 | 日本精品人妻无码免费大全 | 好屌草这里只有精品 | 国产一区二区三区四区五区加勒比 | 成人性做爰aaa片免费看 | 久久精品视频在线看15 | 鲁鲁鲁爽爽爽在线视频观看 | 人人澡人人妻人人爽人人蜜桃 | 欧美第一黄网免费网站 | 欧美日韩综合一区二区三区 | 午夜精品久久久久久久 | 天天综合网天天综合色 | 亚洲精品国产精品乱码不卡 | 女人被爽到呻吟gif动态图视看 | v一区无码内射国产 | 亚洲欧美综合区丁香五月小说 | 久久 国产 尿 小便 嘘嘘 | 99国产精品白浆在线观看免费 | 日日天日日夜日日摸 | 久久久久国色av免费观看性色 | 亚洲精品一区二区三区婷婷月 | 亚洲中文无码av永久不收费 | 人人妻人人澡人人爽精品欧美 | 欧美老熟妇乱xxxxx | 国产一区二区三区四区五区加勒比 | 亚洲国产精华液网站w | 国产成人无码午夜视频在线观看 | 色欲av亚洲一区无码少妇 | 超碰97人人做人人爱少妇 | 成人精品一区二区三区中文字幕 | 一本久道高清无码视频 | 亚洲va中文字幕无码久久不卡 | 久久久精品人妻久久影视 | 亚洲男人av天堂午夜在 | 精品久久久无码中文字幕 | 少妇太爽了在线观看 | 红桃av一区二区三区在线无码av | 欧美日韩久久久精品a片 | 久久 国产 尿 小便 嘘嘘 | 麻豆果冻传媒2021精品传媒一区下载 | av小次郎收藏 | 永久黄网站色视频免费直播 | 男人扒开女人内裤强吻桶进去 | 亚洲熟女一区二区三区 | 亚洲 另类 在线 欧美 制服 | 日韩少妇内射免费播放 | 午夜福利不卡在线视频 | 成人无码精品一区二区三区 | 在线成人www免费观看视频 | 亚洲色成人中文字幕网站 | 欧美日韩久久久精品a片 | 强辱丰满人妻hd中文字幕 | 亚洲色大成网站www | 午夜男女很黄的视频 | 久久成人a毛片免费观看网站 | 欧美猛少妇色xxxxx | 国产亚洲精品久久久闺蜜 | 午夜精品一区二区三区的区别 | 男女猛烈xx00免费视频试看 | 精品国产一区二区三区av 性色 | 在线观看国产一区二区三区 | 啦啦啦www在线观看免费视频 | 国产精品久久久久久久9999 | 亚洲成a人片在线观看无码 | 少女韩国电视剧在线观看完整 | 国产av剧情md精品麻豆 | а天堂中文在线官网 | 丰满少妇高潮惨叫视频 | 99视频精品全部免费免费观看 | 亚洲国产精品毛片av不卡在线 | 久久婷婷五月综合色国产香蕉 | 少妇高潮喷潮久久久影院 | 成在人线av无码免费 | av无码不卡在线观看免费 | 麻豆国产丝袜白领秘书在线观看 | 又粗又大又硬又长又爽 | 熟女少妇在线视频播放 | 丝袜足控一区二区三区 | 正在播放老肥熟妇露脸 | 亚洲人成网站免费播放 | 日韩精品无码一区二区中文字幕 | 亚洲成色在线综合网站 | 成 人 网 站国产免费观看 | 强奷人妻日本中文字幕 | 粗大的内捧猛烈进出视频 | 中文字幕日产无线码一区 | 蜜桃视频韩日免费播放 | 欧美真人作爱免费视频 | 人妻中文无码久热丝袜 | 欧美激情一区二区三区成人 | 狠狠噜狠狠狠狠丁香五月 | 99久久亚洲精品无码毛片 | 性色av无码免费一区二区三区 | 国产农村妇女高潮大叫 | 久久精品国产大片免费观看 | 在线观看国产午夜福利片 | 中文字幕无码日韩专区 | 国产亚洲日韩欧美另类第八页 | 久久99精品久久久久久 | a在线亚洲男人的天堂 | 亚洲自偷自偷在线制服 | 三级4级全黄60分钟 | 亚洲中文无码av永久不收费 | 性欧美牲交在线视频 | 亚洲精品国产第一综合99久久 | 日本一卡2卡3卡4卡无卡免费网站 国产一区二区三区影院 | 性生交片免费无码看人 | 高潮毛片无遮挡高清免费视频 | 日欧一片内射va在线影院 | 亚洲爆乳大丰满无码专区 | 女人高潮内射99精品 | 国产人妖乱国产精品人妖 | 国产亚洲精品精品国产亚洲综合 | 日韩精品一区二区av在线 | 18禁止看的免费污网站 | 亚洲欧美色中文字幕在线 | 麻花豆传媒剧国产免费mv在线 | 国产精品久久久久久亚洲毛片 | 亚洲熟熟妇xxxx | аⅴ资源天堂资源库在线 | 天天躁夜夜躁狠狠是什么心态 | a片免费视频在线观看 | 久久精品国产大片免费观看 | 牲交欧美兽交欧美 | 国产亚洲精品精品国产亚洲综合 | 久久综合九色综合97网 | 欧美日韩色另类综合 | 国产农村妇女高潮大叫 | 久久精品丝袜高跟鞋 | 激情爆乳一区二区三区 | 色婷婷av一区二区三区之红樱桃 | 扒开双腿吃奶呻吟做受视频 | 色五月丁香五月综合五月 | 久久精品女人天堂av免费观看 | 久久久精品国产sm最大网站 | 国産精品久久久久久久 | 中文字幕av无码一区二区三区电影 | 内射老妇bbwx0c0ck | 亚洲中文字幕av在天堂 | 熟妇人妻无乱码中文字幕 | 色偷偷人人澡人人爽人人模 | 99国产欧美久久久精品 | 国产成人人人97超碰超爽8 | 国产69精品久久久久app下载 | 亚洲精品鲁一鲁一区二区三区 | 精品国精品国产自在久国产87 | 国产精品无码永久免费888 | 日日夜夜撸啊撸 | 小鲜肉自慰网站xnxx | 少妇性l交大片欧洲热妇乱xxx | 亚洲熟妇色xxxxx欧美老妇 | 亚洲日本va中文字幕 | 熟妇人妻无码xxx视频 | 精品久久久中文字幕人妻 | 免费看少妇作爱视频 | 国产精品永久免费视频 | 亚洲色在线无码国产精品不卡 | 日日橹狠狠爱欧美视频 | 免费无码一区二区三区蜜桃大 | 国产尤物精品视频 | 两性色午夜免费视频 | 99久久久无码国产精品免费 | 精品人妻人人做人人爽 | 国产激情综合五月久久 | 中文无码精品a∨在线观看不卡 | 少妇人妻偷人精品无码视频 | 未满小14洗澡无码视频网站 | 日日麻批免费40分钟无码 | 日韩av无码一区二区三区 | 无码精品人妻一区二区三区av | 377p欧洲日本亚洲大胆 | 亚洲自偷自拍另类第1页 | 欧美大屁股xxxxhd黑色 | 日韩精品无码免费一区二区三区 | 国产在线精品一区二区三区直播 | 天天摸天天透天天添 | 少妇性荡欲午夜性开放视频剧场 | 清纯唯美经典一区二区 | 久久国产精品二国产精品 | 中文无码伦av中文字幕 | 日韩精品久久久肉伦网站 | 国产另类ts人妖一区二区 | 国产精品视频免费播放 | 欧美zoozzooz性欧美 | 国产免费久久久久久无码 | 国产亲子乱弄免费视频 | 九九久久精品国产免费看小说 | 3d动漫精品啪啪一区二区中 | 成人精品一区二区三区中文字幕 | 国产日产欧产精品精品app | 中文字幕亚洲情99在线 | 国产乱码精品一品二品 | 东京热无码av男人的天堂 | 精品偷自拍另类在线观看 | 亚洲精品中文字幕久久久久 | 中文字幕+乱码+中文字幕一区 | 奇米综合四色77777久久 东京无码熟妇人妻av在线网址 | 日韩成人一区二区三区在线观看 | 久久精品国产99精品亚洲 | 亚洲综合伊人久久大杳蕉 | 欧美日韩亚洲国产精品 | 日本一卡2卡3卡4卡无卡免费网站 国产一区二区三区影院 | 无码国产激情在线观看 | 欧美日韩视频无码一区二区三 | 激情亚洲一区国产精品 | 亚洲精品国偷拍自产在线观看蜜桃 | 日产国产精品亚洲系列 | 无码精品国产va在线观看dvd | 国产成人午夜福利在线播放 | 爽爽影院免费观看 | 久久久久久a亚洲欧洲av冫 | 亚洲日本一区二区三区在线 | 久久精品人人做人人综合试看 | 欧美日韩一区二区免费视频 | 国产办公室秘书无码精品99 | 一本久道久久综合婷婷五月 | 18无码粉嫩小泬无套在线观看 | 亚洲区小说区激情区图片区 | 国产suv精品一区二区五 | 久久精品中文字幕大胸 | 国内精品九九久久久精品 | 激情内射日本一区二区三区 | 老子影院午夜精品无码 | 十八禁真人啪啪免费网站 | 呦交小u女精品视频 | 色偷偷人人澡人人爽人人模 | 99国产精品白浆在线观看免费 | 亚洲国产精品久久久天堂 | 青春草在线视频免费观看 | 青青青爽视频在线观看 | 波多野结衣av在线观看 | 久久99精品久久久久久动态图 | 欧美老人巨大xxxx做受 | 帮老师解开蕾丝奶罩吸乳网站 | 日韩人妻无码一区二区三区久久99 | 国产精品国产自线拍免费软件 | 国产亚洲美女精品久久久2020 | 亚洲欧美日韩成人高清在线一区 | 亚洲一区二区三区偷拍女厕 | 精品国产精品久久一区免费式 | 国产精品va在线观看无码 | 中文字幕精品av一区二区五区 | 久久无码中文字幕免费影院蜜桃 | 亚洲日韩一区二区 | 亚洲日韩一区二区三区 | 成人无码精品一区二区三区 | 久久精品一区二区三区四区 | 曰本女人与公拘交酡免费视频 | 日韩精品乱码av一区二区 | 久久人人爽人人爽人人片ⅴ | 亚洲最大成人网站 | 丰满少妇弄高潮了www | 国产免费观看黄av片 | 大乳丰满人妻中文字幕日本 | 亚洲狠狠婷婷综合久久 | 精品午夜福利在线观看 | 美女张开腿让人桶 | 一本色道婷婷久久欧美 | 中文字幕日产无线码一区 | 国产成人综合色在线观看网站 | 久久成人a毛片免费观看网站 | 国模大胆一区二区三区 | 人妻少妇精品无码专区动漫 | 全球成人中文在线 | 东京热一精品无码av | 18无码粉嫩小泬无套在线观看 | 久久久久人妻一区精品色欧美 | 人妻体内射精一区二区三四 | 蜜桃av蜜臀av色欲av麻 999久久久国产精品消防器材 | 欧美第一黄网免费网站 | 日韩人妻少妇一区二区三区 | 5858s亚洲色大成网站www | 疯狂三人交性欧美 | 女高中生第一次破苞av | 精品国产国产综合精品 | 国产高潮视频在线观看 | 人人妻人人澡人人爽人人精品 | 久久zyz资源站无码中文动漫 | 奇米影视7777久久精品人人爽 | 欧美变态另类xxxx | 日产国产精品亚洲系列 | 国产suv精品一区二区五 | 无码精品人妻一区二区三区av | 亚洲国产av精品一区二区蜜芽 | 亚洲gv猛男gv无码男同 | 国产精品久免费的黄网站 | 亚洲伊人久久精品影院 | 国产电影无码午夜在线播放 | 亚洲一区二区三区在线观看网站 | 呦交小u女精品视频 | 少妇久久久久久人妻无码 | 国产精品人人妻人人爽 | 狠狠色色综合网站 | 国产做国产爱免费视频 | 波多野结衣av在线观看 | 性欧美牲交在线视频 | 三级4级全黄60分钟 | 中文字幕av无码一区二区三区电影 | 伊人久久大香线蕉av一区二区 | 熟女体下毛毛黑森林 | 亚洲精品美女久久久久久久 | 无码播放一区二区三区 | 久久久亚洲欧洲日产国码αv | 大肉大捧一进一出视频出来呀 | 国精产品一区二区三区 | 成人亚洲精品久久久久软件 | 欧美人与物videos另类 | 永久黄网站色视频免费直播 | 亚洲 a v无 码免 费 成 人 a v | 国产午夜福利100集发布 | 久久精品人人做人人综合试看 | 亚洲熟悉妇女xxx妇女av | 欧美变态另类xxxx | 国产精品理论片在线观看 | 精品亚洲韩国一区二区三区 | 麻豆蜜桃av蜜臀av色欲av | 少妇无码av无码专区在线观看 | 免费国产成人高清在线观看网站 | 国产成人精品三级麻豆 | 无遮挡啪啪摇乳动态图 | 久久久久人妻一区精品色欧美 | 天堂久久天堂av色综合 | 国产精品无码一区二区三区不卡 | 日日摸夜夜摸狠狠摸婷婷 | 色综合久久中文娱乐网 | 爽爽影院免费观看 | 午夜肉伦伦影院 | 精品欧洲av无码一区二区三区 | a片免费视频在线观看 | 无码人妻精品一区二区三区不卡 | 2019午夜福利不卡片在线 | 日本精品人妻无码免费大全 | 亚无码乱人伦一区二区 | 男人的天堂av网站 | 国产色精品久久人妻 | 欧洲精品码一区二区三区免费看 | 国产人妻大战黑人第1集 | 中文字幕无码人妻少妇免费 | 国产精品福利视频导航 | 激情综合激情五月俺也去 | 中文无码精品a∨在线观看不卡 | 宝宝好涨水快流出来免费视频 | 亚洲精品中文字幕 | 综合激情五月综合激情五月激情1 | 人妻aⅴ无码一区二区三区 | 欧美日韩一区二区三区自拍 | 美女极度色诱视频国产 | 亚洲精品一区二区三区婷婷月 | 少妇一晚三次一区二区三区 | 无码国产色欲xxxxx视频 | 三级4级全黄60分钟 | 男女性色大片免费网站 | 日韩精品a片一区二区三区妖精 | 亚洲另类伦春色综合小说 | 性色欲网站人妻丰满中文久久不卡 | 久久99精品久久久久久 | 丰满少妇熟乱xxxxx视频 | 亚洲国产午夜精品理论片 | 日韩亚洲欧美精品综合 | 曰韩少妇内射免费播放 | 亚洲精品一区二区三区婷婷月 | 九月婷婷人人澡人人添人人爽 | 国产两女互慰高潮视频在线观看 | 国产乱人伦av在线无码 | 日本xxxx色视频在线观看免费 | 国产99久久精品一区二区 | aa片在线观看视频在线播放 | 久久久久av无码免费网 | 无码av岛国片在线播放 | 妺妺窝人体色www在线小说 | 人妻少妇精品无码专区二区 | 国产卡一卡二卡三 | 亚洲精品久久久久久一区二区 | 丰满少妇熟乱xxxxx视频 | 亚洲 日韩 欧美 成人 在线观看 | 成在人线av无码免观看麻豆 | 亚洲精品一区二区三区在线 | 中文字幕av日韩精品一区二区 | 无码国产色欲xxxxx视频 | 国产精品久久久午夜夜伦鲁鲁 | 国产人妻大战黑人第1集 | 人妻与老人中文字幕 | 18禁黄网站男男禁片免费观看 | а√资源新版在线天堂 | 亚洲乱码中文字幕在线 | 国产午夜无码精品免费看 | 国产精品va在线观看无码 | 国产 浪潮av性色四虎 | √天堂中文官网8在线 | 伊人色综合久久天天小片 | 亚洲精品一区二区三区在线观看 | 无套内谢老熟女 | 亚洲日韩一区二区 | 中文字幕日韩精品一区二区三区 | 色综合视频一区二区三区 | 国产亚洲精品久久久久久久久动漫 | 欧美日韩人成综合在线播放 | 动漫av网站免费观看 | 中文字幕 人妻熟女 | 国内揄拍国内精品人妻 | 国产高清不卡无码视频 | 久久久婷婷五月亚洲97号色 | 国产成人综合色在线观看网站 | 亚洲自偷自拍另类第1页 | 好屌草这里只有精品 | 国产偷自视频区视频 | 色婷婷综合中文久久一本 | 青春草在线视频免费观看 | 日日橹狠狠爱欧美视频 | 99麻豆久久久国产精品免费 | 2020最新国产自产精品 | 亚洲а∨天堂久久精品2021 | 精品一区二区三区波多野结衣 | 欧美精品国产综合久久 | 中文字幕av日韩精品一区二区 | 久久无码中文字幕免费影院蜜桃 | 秋霞特色aa大片 | 欧美老人巨大xxxx做受 | 国产精品人妻一区二区三区四 | 欧洲vodafone精品性 | 成人试看120秒体验区 | 日日鲁鲁鲁夜夜爽爽狠狠 | 久久精品人人做人人综合 | 蜜桃视频插满18在线观看 | 日本精品人妻无码免费大全 | 国产精品无套呻吟在线 | 成人试看120秒体验区 | 亚洲狠狠色丁香婷婷综合 | 2019nv天堂香蕉在线观看 | 99久久婷婷国产综合精品青草免费 | 日韩人妻无码中文字幕视频 | 伊人久久大香线蕉av一区二区 | 中文字幕精品av一区二区五区 | 国产小呦泬泬99精品 | 国产综合久久久久鬼色 | 丁香花在线影院观看在线播放 | 国产亚洲欧美日韩亚洲中文色 | 美女扒开屁股让男人桶 | 久久综合久久自在自线精品自 | 久久综合香蕉国产蜜臀av | 2019午夜福利不卡片在线 | 丰满人妻翻云覆雨呻吟视频 | 2020久久超碰国产精品最新 | 亚洲国产av精品一区二区蜜芽 | 老子影院午夜精品无码 | 97精品人妻一区二区三区香蕉 | 久久国产自偷自偷免费一区调 | 欧洲熟妇精品视频 | 国产两女互慰高潮视频在线观看 | 国产亚洲精品久久久闺蜜 | 午夜精品久久久久久久 | 国产舌乚八伦偷品w中 | 天干天干啦夜天干天2017 | 在线天堂新版最新版在线8 | 天堂亚洲免费视频 | 亚洲午夜无码久久 | 日本www一道久久久免费榴莲 | 2019nv天堂香蕉在线观看 | a片在线免费观看 | av无码不卡在线观看免费 | 欧洲熟妇色 欧美 | 国产性生交xxxxx无码 | 少妇高潮喷潮久久久影院 | 日韩 欧美 动漫 国产 制服 | 一本色道婷婷久久欧美 | 亚洲欧洲日本综合aⅴ在线 | 精品 日韩 国产 欧美 视频 | 无码成人精品区在线观看 | av无码久久久久不卡免费网站 | 成人免费视频在线观看 | 国产精品高潮呻吟av久久4虎 | 国产精品沙发午睡系列 | 国产亚洲精品久久久久久久久动漫 | 国产精品理论片在线观看 | 国产精品久久久久久久影院 | 强开小婷嫩苞又嫩又紧视频 | 在线观看免费人成视频 | 亚无码乱人伦一区二区 | 国内揄拍国内精品人妻 | 蜜臀aⅴ国产精品久久久国产老师 | 又黄又爽又色的视频 | 一本色道婷婷久久欧美 | 国产乱码精品一品二品 | 秋霞成人午夜鲁丝一区二区三区 | 高潮毛片无遮挡高清免费 | 国产精品亚洲专区无码不卡 | 免费中文字幕日韩欧美 | 亚洲最大成人网站 | 蜜桃av蜜臀av色欲av麻 999久久久国产精品消防器材 | 在线а√天堂中文官网 | 国产av久久久久精东av | 丰满妇女强制高潮18xxxx | 欧美国产日韩久久mv | 乌克兰少妇性做爰 | 东京无码熟妇人妻av在线网址 | v一区无码内射国产 | 国产午夜亚洲精品不卡 | 成人欧美一区二区三区 | 亚洲精品一区二区三区婷婷月 | 亚洲一区二区三区偷拍女厕 | 麻豆国产丝袜白领秘书在线观看 | 精品久久久久久亚洲精品 | 日韩无套无码精品 | 欧美成人高清在线播放 | 国产真人无遮挡作爱免费视频 | 亚洲精品一区二区三区婷婷月 | 蜜桃av抽搐高潮一区二区 | 中文字幕+乱码+中文字幕一区 | yw尤物av无码国产在线观看 | 少妇性l交大片欧洲热妇乱xxx | aa片在线观看视频在线播放 | 色婷婷av一区二区三区之红樱桃 | 欧美国产亚洲日韩在线二区 | 国产乱人无码伦av在线a | 曰韩少妇内射免费播放 | 在线视频网站www色 | 1000部夫妻午夜免费 | 午夜福利不卡在线视频 | 亚洲第一网站男人都懂 | 无码午夜成人1000部免费视频 | 中文字幕乱码人妻无码久久 | 亚洲综合无码久久精品综合 | 久9re热视频这里只有精品 | 久精品国产欧美亚洲色aⅴ大片 | 人人妻人人澡人人爽人人精品浪潮 | 人妻互换免费中文字幕 | 欧美丰满熟妇xxxx | 久久zyz资源站无码中文动漫 | 欧美性生交活xxxxxdddd | 女人色极品影院 | 午夜精品一区二区三区的区别 | 国产午夜福利亚洲第一 | 精品无码一区二区三区的天堂 | 撕开奶罩揉吮奶头视频 | 一本大道伊人av久久综合 | 欧美丰满熟妇xxxx | 人妻少妇精品无码专区二区 | 欧洲熟妇色 欧美 | 特级做a爰片毛片免费69 | 亚洲熟妇自偷自拍另类 | 日本va欧美va欧美va精品 | 久久久久久九九精品久 | 精品欧洲av无码一区二区三区 | 日韩精品a片一区二区三区妖精 | 天海翼激烈高潮到腰振不止 | 人妻人人添人妻人人爱 | 国产人妻人伦精品1国产丝袜 | 未满成年国产在线观看 | 国产国产精品人在线视 | 男女猛烈xx00免费视频试看 | 内射后入在线观看一区 | 又大又紧又粉嫩18p少妇 | 日本熟妇浓毛 | 亚洲精品国产第一综合99久久 | 日本乱人伦片中文三区 | 国产精品手机免费 | 亚洲成在人网站无码天堂 | 无码午夜成人1000部免费视频 | 欧美日韩久久久精品a片 | 久久人人爽人人爽人人片av高清 | 中文无码成人免费视频在线观看 | 久9re热视频这里只有精品 | 亚洲最大成人网站 | 亚洲の无码国产の无码步美 | 国内揄拍国内精品人妻 | аⅴ资源天堂资源库在线 | 久久99热只有频精品8 | √8天堂资源地址中文在线 | 国产精品久久久久久无码 | 永久免费观看美女裸体的网站 | 国产精品人人爽人人做我的可爱 | 中文字幕无码免费久久99 | 在线播放亚洲第一字幕 | yw尤物av无码国产在线观看 | 领导边摸边吃奶边做爽在线观看 | 国内精品人妻无码久久久影院 | 日韩少妇白浆无码系列 | 国产无套粉嫩白浆在线 | 好屌草这里只有精品 | 国产人妻人伦精品 | 精品欧美一区二区三区久久久 | 久久无码中文字幕免费影院蜜桃 | 亚洲乱码国产乱码精品精 | 欧美人与禽猛交狂配 | 久久久久成人片免费观看蜜芽 | 色综合久久久久综合一本到桃花网 | 亚洲色大成网站www国产 | 欧美肥老太牲交大战 | 亚洲爆乳精品无码一区二区三区 | 波多野结衣av在线观看 | 99久久精品午夜一区二区 | 久久久久久a亚洲欧洲av冫 | 无码人妻精品一区二区三区下载 | 亚洲男女内射在线播放 | 九九综合va免费看 | 麻豆国产人妻欲求不满谁演的 | 欧洲精品码一区二区三区免费看 | 蜜臀aⅴ国产精品久久久国产老师 | 无码毛片视频一区二区本码 | 在线观看欧美一区二区三区 | 国产婷婷色一区二区三区在线 | 色欲久久久天天天综合网精品 | 中文字幕无码日韩欧毛 | 午夜免费福利小电影 | 丰满岳乱妇在线观看中字无码 | 国产精品第一区揄拍无码 | 国产无套内射久久久国产 | 国产无套粉嫩白浆在线 | ass日本丰满熟妇pics | 国产欧美亚洲精品a | 国产人妻精品一区二区三区不卡 | 1000部啪啪未满十八勿入下载 | 乱中年女人伦av三区 | 久久97精品久久久久久久不卡 | 丰满护士巨好爽好大乳 | 国产精品国产三级国产专播 | 又紧又大又爽精品一区二区 | 国产超碰人人爽人人做人人添 | 亚洲精品一区国产 | 国产口爆吞精在线视频 | 最新国产乱人伦偷精品免费网站 | 国精产品一品二品国精品69xx | 免费乱码人妻系列无码专区 | 欧美兽交xxxx×视频 | 国产成人无码av片在线观看不卡 | 亚洲阿v天堂在线 | 欧美自拍另类欧美综合图片区 | 色情久久久av熟女人妻网站 | 国产精品毛片一区二区 | 国产精品亚洲综合色区韩国 | 丰满妇女强制高潮18xxxx | 日本精品久久久久中文字幕 | 亚洲中文字幕va福利 | 青春草在线视频免费观看 | 波多野结衣 黑人 | 欧美高清在线精品一区 | 久久综合九色综合欧美狠狠 | 亚洲自偷自偷在线制服 | 亚洲一区av无码专区在线观看 | 无码人妻av免费一区二区三区 | 精品久久久久香蕉网 | 捆绑白丝粉色jk震动捧喷白浆 | 亚洲の无码国产の无码步美 | 性生交大片免费看女人按摩摩 | 丝袜 中出 制服 人妻 美腿 | 成在人线av无码免费 | 性色欲网站人妻丰满中文久久不卡 | 亚洲精品综合一区二区三区在线 | 国产精品怡红院永久免费 | 正在播放老肥熟妇露脸 | 中文字幕日产无线码一区 | 人人妻人人澡人人爽欧美一区 | 九九热爱视频精品 | 天堂在线观看www | 国产精品无码成人午夜电影 | 2019nv天堂香蕉在线观看 | 正在播放东北夫妻内射 | 国产办公室秘书无码精品99 | 精品国产乱码久久久久乱码 | 中文字幕无码人妻少妇免费 | 国产精品嫩草久久久久 | 麻豆精品国产精华精华液好用吗 | 日韩av激情在线观看 | 高清无码午夜福利视频 | 亚洲成av人在线观看网址 | 欧美野外疯狂做受xxxx高潮 | 国产女主播喷水视频在线观看 | 欧美国产日韩久久mv | 欧美亚洲日韩国产人成在线播放 | 97se亚洲精品一区 | 亚洲精品中文字幕 | 夜夜高潮次次欢爽av女 | 日本爽爽爽爽爽爽在线观看免 | 秋霞特色aa大片 | 国产精品久久久久久久影院 | 亚洲一区二区三区四区 | 日本成熟视频免费视频 | 亚洲欧美国产精品久久 | 小鲜肉自慰网站xnxx | 最近免费中文字幕中文高清百度 | 国内揄拍国内精品少妇国语 | 久久久中文久久久无码 | 黑人巨大精品欧美黑寡妇 | 无码人妻少妇伦在线电影 | 1000部夫妻午夜免费 | 窝窝午夜理论片影院 | 内射欧美老妇wbb | 国产成人精品三级麻豆 | 国产成人综合美国十次 | 日本丰满护士爆乳xxxx | 欧美日韩视频无码一区二区三 | 亚洲一区二区三区在线观看网站 | 自拍偷自拍亚洲精品被多人伦好爽 | 国产后入清纯学生妹 | 99久久久国产精品无码免费 | 国产精品毛片一区二区 | 红桃av一区二区三区在线无码av | 欧美野外疯狂做受xxxx高潮 | 亚洲午夜久久久影院 | 亚洲熟妇自偷自拍另类 | 捆绑白丝粉色jk震动捧喷白浆 | 东京无码熟妇人妻av在线网址 | 日日麻批免费40分钟无码 | 水蜜桃色314在线观看 | 丝袜人妻一区二区三区 | 午夜熟女插插xx免费视频 | 成 人 网 站国产免费观看 | 日韩欧美中文字幕公布 | 亚洲成av人片天堂网无码】 | 99国产精品白浆在线观看免费 | 欧洲精品码一区二区三区免费看 | 学生妹亚洲一区二区 | 国产猛烈高潮尖叫视频免费 | 久久久精品456亚洲影院 | 国产激情无码一区二区app | 伊人久久大香线蕉亚洲 | 中文无码精品a∨在线观看不卡 | 永久免费观看国产裸体美女 | 久久亚洲精品成人无码 | 久久久久亚洲精品男人的天堂 | 国产亚洲精品久久久久久久久动漫 | 国产9 9在线 | 中文 | 国产亲子乱弄免费视频 | 男人和女人高潮免费网站 | 成 人 免费观看网站 | 国产精品无码一区二区桃花视频 | 对白脏话肉麻粗话av | 亚洲日韩乱码中文无码蜜桃臀网站 | 亚洲国产精品毛片av不卡在线 | 一个人免费观看的www视频 | 日韩亚洲欧美中文高清在线 | 2019nv天堂香蕉在线观看 | 亚洲va欧美va天堂v国产综合 | 狠狠色噜噜狠狠狠7777奇米 | 美女张开腿让人桶 | av无码不卡在线观看免费 | 亚洲成a人片在线观看无码 | 黑人大群体交免费视频 | 女人被男人爽到呻吟的视频 | 欧美老人巨大xxxx做受 | 一本大道伊人av久久综合 | 丰满妇女强制高潮18xxxx | 欧美变态另类xxxx | 无码纯肉视频在线观看 | 亚洲码国产精品高潮在线 | 性色av无码免费一区二区三区 | 男人扒开女人内裤强吻桶进去 | 国产综合色产在线精品 | 精品无码成人片一区二区98 | 亚洲精品一区二区三区在线观看 | 亚洲国产精华液网站w | 激情五月综合色婷婷一区二区 | 亚洲の无码国产の无码步美 | 55夜色66夜色国产精品视频 | 国产av一区二区精品久久凹凸 | 成人综合网亚洲伊人 | 最近中文2019字幕第二页 | 88国产精品欧美一区二区三区 | 久久久久久久人妻无码中文字幕爆 | 国产无遮挡又黄又爽又色 | 免费乱码人妻系列无码专区 | 亚洲 a v无 码免 费 成 人 a v | 久久久www成人免费毛片 | 亚洲理论电影在线观看 | 亚洲熟女一区二区三区 | 国产午夜福利100集发布 | 日韩 欧美 动漫 国产 制服 | 中文字幕精品av一区二区五区 | 亚洲精品国产精品乱码视色 | 欧美日本精品一区二区三区 | 久久99精品久久久久婷婷 | 国产精品久久久久9999小说 | 成在人线av无码免观看麻豆 | 国产精品高潮呻吟av久久 | 人人妻人人澡人人爽精品欧美 | 日本高清一区免费中文视频 | 婷婷色婷婷开心五月四房播播 | 少妇无码av无码专区在线观看 | 玩弄人妻少妇500系列视频 | 亚洲精品www久久久 | 人妻无码αv中文字幕久久琪琪布 | 中文字幕av日韩精品一区二区 | 亚洲综合另类小说色区 | 久久午夜夜伦鲁鲁片无码免费 | 色妞www精品免费视频 | 久久午夜无码鲁丝片 | 国产午夜无码精品免费看 | 久久无码中文字幕免费影院蜜桃 | 精品国偷自产在线视频 | 亚洲精品久久久久中文第一幕 | 成熟妇人a片免费看网站 | 日本va欧美va欧美va精品 | 色综合久久中文娱乐网 | 免费国产黄网站在线观看 | 少妇性荡欲午夜性开放视频剧场 | 夫妻免费无码v看片 | 国产精品香蕉在线观看 | 久久精品女人的天堂av | 乱人伦人妻中文字幕无码 | 99久久久国产精品无码免费 | 国产精品久久久久久亚洲毛片 | 荫蒂被男人添的好舒服爽免费视频 | 蜜桃臀无码内射一区二区三区 | 国产麻豆精品一区二区三区v视界 | 久久亚洲日韩精品一区二区三区 | 99久久精品无码一区二区毛片 | 亚洲精品久久久久久久久久久 | 动漫av网站免费观看 | 国产激情综合五月久久 | 国产精品国产三级国产专播 | 中文字幕无码av激情不卡 | 成人一区二区免费视频 | 人人妻人人澡人人爽欧美一区九九 | 国产午夜无码视频在线观看 | 欧美自拍另类欧美综合图片区 | www国产精品内射老师 | 国产亚洲视频中文字幕97精品 | 欧美精品无码一区二区三区 | 国产色在线 | 国产 | 性欧美牲交xxxxx视频 | 中文字幕人成乱码熟女app | 午夜理论片yy44880影院 | 久久久久99精品国产片 | 亚洲色偷偷男人的天堂 | 乌克兰少妇性做爰 | 野狼第一精品社区 | 熟妇人妻无码xxx视频 | 久久www免费人成人片 | 日韩精品无码一本二本三本色 | 99精品无人区乱码1区2区3区 | 久久久精品456亚洲影院 | av人摸人人人澡人人超碰下载 | 老子影院午夜精品无码 | 欧美人与禽猛交狂配 | 久久久久99精品成人片 | 天天做天天爱天天爽综合网 | 日本熟妇人妻xxxxx人hd | 老熟妇仑乱视频一区二区 | 婷婷五月综合缴情在线视频 | а√资源新版在线天堂 | 无码av中文字幕免费放 | 日日鲁鲁鲁夜夜爽爽狠狠 | 久久国产精品二国产精品 | 国产av一区二区精品久久凹凸 | 国产精品沙发午睡系列 | 99精品视频在线观看免费 | 日本丰满护士爆乳xxxx | 无遮挡国产高潮视频免费观看 | 丰满少妇女裸体bbw | 国产精华av午夜在线观看 | 综合激情五月综合激情五月激情1 | 久久久www成人免费毛片 | 西西人体www44rt大胆高清 | 久久久久99精品成人片 | 国内少妇偷人精品视频 | 成人动漫在线观看 | 性做久久久久久久久 | 青草青草久热国产精品 | 亚洲爆乳精品无码一区二区三区 | 亚洲精品国产第一综合99久久 | 成人无码视频在线观看网站 | 正在播放老肥熟妇露脸 | 国产无av码在线观看 | 性啪啪chinese东北女人 | 99久久无码一区人妻 | 日韩欧美中文字幕在线三区 | 亚洲午夜福利在线观看 | 国产疯狂伦交大片 | 国产精品人妻一区二区三区四 | 中文字幕 亚洲精品 第1页 | 国产乱人偷精品人妻a片 | 国产精品.xx视频.xxtv | 一本色道婷婷久久欧美 | 网友自拍区视频精品 | 成年美女黄网站色大免费全看 | 国产人成高清在线视频99最全资源 | 永久免费观看国产裸体美女 | 欧美一区二区三区 | 青青青爽视频在线观看 | 亚洲精品一区二区三区在线观看 | 亚洲国产精品无码久久久久高潮 | 中文字幕人妻无码一区二区三区 | 免费人成网站视频在线观看 | 人人妻人人澡人人爽欧美精品 | 亚洲狠狠婷婷综合久久 | 97无码免费人妻超级碰碰夜夜 | 九九久久精品国产免费看小说 | 午夜福利电影 | 久久人人97超碰a片精品 | 九九在线中文字幕无码 | 无码国内精品人妻少妇 | 久久99精品久久久久久 | 99久久久无码国产aaa精品 | 国产莉萝无码av在线播放 | 国产片av国语在线观看 | 久久精品视频在线看15 | 2019nv天堂香蕉在线观看 | 久热国产vs视频在线观看 | 无码av最新清无码专区吞精 | 红桃av一区二区三区在线无码av | 一本久久伊人热热精品中文字幕 | 2020久久香蕉国产线看观看 | 日韩欧美群交p片內射中文 | 国产人妻久久精品二区三区老狼 | 无码一区二区三区在线观看 | 久久国产精品萌白酱免费 | 国产麻豆精品一区二区三区v视界 | 亚洲欧美综合区丁香五月小说 | 色综合天天综合狠狠爱 | 久久无码人妻影院 | 日本高清一区免费中文视频 | 麻豆精产国品 | 亚洲爆乳无码专区 | 少妇性荡欲午夜性开放视频剧场 | 性色欲情网站iwww九文堂 | 免费人成网站视频在线观看 | 乌克兰少妇性做爰 | 水蜜桃av无码 | 欧美大屁股xxxxhd黑色 | 天天躁夜夜躁狠狠是什么心态 | 久精品国产欧美亚洲色aⅴ大片 | 久久国产精品偷任你爽任你 | 性做久久久久久久免费看 | 人妻少妇精品视频专区 | 成人精品天堂一区二区三区 | 亚洲一区二区三区无码久久 | 亚洲综合在线一区二区三区 | 亚洲小说图区综合在线 | 亚欧洲精品在线视频免费观看 | 亚洲日韩中文字幕在线播放 | 亚洲娇小与黑人巨大交 | 久久久久久亚洲精品a片成人 | 一区二区传媒有限公司 | 亚洲精品无码国产 | 亚洲熟妇色xxxxx欧美老妇 | 国产三级久久久精品麻豆三级 | 日韩av激情在线观看 | 无码毛片视频一区二区本码 | 在线精品亚洲一区二区 | 久久99精品久久久久久 | 老头边吃奶边弄进去呻吟 | 午夜男女很黄的视频 | 99久久精品日本一区二区免费 | 亚洲a无码综合a国产av中文 | 少妇无码一区二区二三区 | 亚洲七七久久桃花影院 | 国产熟妇另类久久久久 | 粉嫩少妇内射浓精videos | 国产成人精品视频ⅴa片软件竹菊 | 激情五月综合色婷婷一区二区 | 国产精品va在线观看无码 | 精品久久久久久人妻无码中文字幕 | 两性色午夜视频免费播放 | 欧美精品无码一区二区三区 | 成人精品天堂一区二区三区 | 国产偷自视频区视频 | 乱码午夜-极国产极内射 | 日韩精品乱码av一区二区 | 国产成人精品视频ⅴa片软件竹菊 | 少妇厨房愉情理9仑片视频 | 熟妇激情内射com | 国产乱人伦av在线无码 | 国产激情综合五月久久 | 亚洲色成人中文字幕网站 | 精品国产一区二区三区四区在线看 | 日产精品高潮呻吟av久久 | 黑人巨大精品欧美一区二区 | 中文字幕日产无线码一区 | 少妇愉情理伦片bd | 久久综合狠狠综合久久综合88 | 成人性做爰aaa片免费看 | 欧美日韩一区二区三区自拍 | 少妇人妻偷人精品无码视频 | 亚洲欧美综合区丁香五月小说 | 成人动漫在线观看 | 国产精品免费大片 | 久久www免费人成人片 | 无码国产色欲xxxxx视频 | 国产精品久久久久久无码 | 丰满岳乱妇在线观看中字无码 | 四十如虎的丰满熟妇啪啪 | 青草视频在线播放 | 亚洲 a v无 码免 费 成 人 a v | 亚洲一区二区三区播放 | 亚洲精品国偷拍自产在线麻豆 | 亚洲日韩av一区二区三区中文 | 亚洲精品一区二区三区婷婷月 | 一本精品99久久精品77 | 无码人妻丰满熟妇区毛片18 | 亚洲国产精品久久久久久 | 无码精品国产va在线观看dvd | 久久久久久久人妻无码中文字幕爆 | 无码人妻精品一区二区三区下载 | 久久久精品人妻久久影视 | 色婷婷香蕉在线一区二区 | 99麻豆久久久国产精品免费 | 天堂а√在线中文在线 | 亚洲高清偷拍一区二区三区 | 亚洲国产一区二区三区在线观看 | 亚洲一区二区三区无码久久 | 欧美日本免费一区二区三区 | 大乳丰满人妻中文字幕日本 | 国产av剧情md精品麻豆 | 国产三级精品三级男人的天堂 | 精品国偷自产在线视频 | 国产农村妇女高潮大叫 | 午夜嘿嘿嘿影院 | 国产在线无码精品电影网 | av在线亚洲欧洲日产一区二区 | 成人精品视频一区二区三区尤物 | 日韩亚洲欧美中文高清在线 | 日本成熟视频免费视频 | 伊人久久大香线焦av综合影院 | 国产精品毛多多水多 | 国产高清不卡无码视频 | 亚洲精品国产第一综合99久久 | 2020最新国产自产精品 | 少妇性l交大片 | 久久成人a毛片免费观看网站 | 中文毛片无遮挡高清免费 | 亚洲熟妇色xxxxx欧美老妇 | 清纯唯美经典一区二区 | 国产国语老龄妇女a片 | 国产精品国产自线拍免费软件 | 国产精品99久久精品爆乳 | 少妇性俱乐部纵欲狂欢电影 | 欧美性猛交内射兽交老熟妇 | 欧洲熟妇色 欧美 | 国产精品人人爽人人做我的可爱 | 久久综合香蕉国产蜜臀av | 欧美人与禽zoz0性伦交 | 国产午夜无码精品免费看 | 国产性猛交╳xxx乱大交 国产精品久久久久久无码 欧洲欧美人成视频在线 | 久久国语露脸国产精品电影 | 亚洲精品鲁一鲁一区二区三区 | 奇米影视7777久久精品人人爽 | 精品人妻人人做人人爽夜夜爽 | 亚洲 另类 在线 欧美 制服 | 国产亲子乱弄免费视频 | 国产人妻人伦精品1国产丝袜 | 日本乱偷人妻中文字幕 | 东京一本一道一二三区 | 日产精品高潮呻吟av久久 | 高潮喷水的毛片 | 亚洲小说春色综合另类 | 国产成人精品视频ⅴa片软件竹菊 | 国内老熟妇对白xxxxhd | av小次郎收藏 | 2019午夜福利不卡片在线 | 色综合久久中文娱乐网 | 国产激情无码一区二区 | 国产性生大片免费观看性 | 永久黄网站色视频免费直播 | 蜜臀av在线观看 在线欧美精品一区二区三区 | 荫蒂添的好舒服视频囗交 | 国产精品美女久久久 | 日本丰满熟妇videos | 亚洲狠狠婷婷综合久久 | 99riav国产精品视频 | 丰满妇女强制高潮18xxxx | 少妇人妻av毛片在线看 | 沈阳熟女露脸对白视频 | 国产成人人人97超碰超爽8 | 水蜜桃亚洲一二三四在线 | 九九综合va免费看 | 我要看www免费看插插视频 | 国产成人无码a区在线观看视频app | 无码av岛国片在线播放 | 麻豆国产人妻欲求不满 | 日本一区二区三区免费播放 | 狠狠色丁香久久婷婷综合五月 | 东京无码熟妇人妻av在线网址 | 国产精品对白交换视频 | 日本乱人伦片中文三区 | 任你躁国产自任一区二区三区 | 最近的中文字幕在线看视频 | 精品久久久中文字幕人妻 | 捆绑白丝粉色jk震动捧喷白浆 | 最近的中文字幕在线看视频 | 国产精品手机免费 | 国语精品一区二区三区 | 人妻尝试又大又粗久久 | 成 人 网 站国产免费观看 | 亚洲乱码国产乱码精品精 | 美女黄网站人色视频免费国产 | 久久精品无码一区二区三区 | 丰满少妇高潮惨叫视频 | 无码av免费一区二区三区试看 | 中国女人内谢69xxxxxa片 | 人妻体内射精一区二区三四 | 精品国产一区av天美传媒 | 中国女人内谢69xxxxxa片 | 亚洲中文无码av永久不收费 | 中文字幕乱码人妻无码久久 | 少妇性俱乐部纵欲狂欢电影 | 国产精品无码永久免费888 | 久久久无码中文字幕久... | 好男人社区资源 | 国产色在线 | 国产 | 最新国产麻豆aⅴ精品无码 | 高清无码午夜福利视频 | 亚洲中文字幕在线无码一区二区 | 欧美人与善在线com | 国产亚洲欧美在线专区 | 中文字幕+乱码+中文字幕一区 | 18精品久久久无码午夜福利 | 麻豆av传媒蜜桃天美传媒 | 红桃av一区二区三区在线无码av | 乱码午夜-极国产极内射 | 亚洲精品午夜国产va久久成人 | 国产乱人伦偷精品视频 | 女高中生第一次破苞av | 久久久久亚洲精品男人的天堂 | 偷窥日本少妇撒尿chinese | 亚洲一区二区三区含羞草 | 欧美大屁股xxxxhd黑色 | 国产偷国产偷精品高清尤物 | 国产亚洲美女精品久久久2020 | 亚洲国产欧美日韩精品一区二区三区 | 久久综合九色综合欧美狠狠 | 无码吃奶揉捏奶头高潮视频 | 婷婷六月久久综合丁香 | 国内精品九九久久久精品 | 久久99精品国产.久久久久 | 亚洲一区二区三区无码久久 | 欧美亚洲国产一区二区三区 | 两性色午夜免费视频 | 风流少妇按摩来高潮 | 女人被爽到呻吟gif动态图视看 | 黑人玩弄人妻中文在线 | 国产成人午夜福利在线播放 | 极品尤物被啪到呻吟喷水 | 天海翼激烈高潮到腰振不止 | 亚洲色偷偷男人的天堂 | 色五月五月丁香亚洲综合网 | 免费国产成人高清在线观看网站 | 99精品久久毛片a片 | 国产亚洲精品久久久久久久 | 性色欲情网站iwww九文堂 | 精品人妻人人做人人爽 | 亚洲日本va中文字幕 | 国产精品va在线播放 | 秋霞成人午夜鲁丝一区二区三区 | 老司机亚洲精品影院无码 | 成人试看120秒体验区 | 纯爱无遮挡h肉动漫在线播放 | 丰满人妻被黑人猛烈进入 | 狂野欧美性猛xxxx乱大交 | а天堂中文在线官网 | 全球成人中文在线 | 综合激情五月综合激情五月激情1 | 2020久久香蕉国产线看观看 | 亚洲自偷自拍另类第1页 | 久久无码中文字幕免费影院蜜桃 | 国产精品免费大片 | 欧洲熟妇精品视频 | 牲欲强的熟妇农村老妇女视频 | 日本一本二本三区免费 | 欧美黑人乱大交 | 久久国产精品偷任你爽任你 | 樱花草在线播放免费中文 | 性色欲网站人妻丰满中文久久不卡 | 成人三级无码视频在线观看 | 亚洲国产精品成人久久蜜臀 | 牲交欧美兽交欧美 | 午夜福利电影 | 少妇无套内谢久久久久 | 久热国产vs视频在线观看 | 亚洲精品美女久久久久久久 | 国产成人精品必看 | 日本成熟视频免费视频 | 网友自拍区视频精品 | 一本色道久久综合狠狠躁 | 夜夜影院未满十八勿进 | 亚洲综合另类小说色区 | 日韩欧美中文字幕公布 | av人摸人人人澡人人超碰下载 | 玩弄人妻少妇500系列视频 | 亚洲综合精品香蕉久久网 | 综合激情五月综合激情五月激情1 | 精品成在人线av无码免费看 | 荫蒂被男人添的好舒服爽免费视频 | 免费无码av一区二区 | 免费看少妇作爱视频 | 无码人妻少妇伦在线电影 | 99精品国产综合久久久久五月天 | 久久久中文字幕日本无吗 | 亚洲午夜无码久久 | 人妻少妇精品无码专区二区 | 97人妻精品一区二区三区 | 欧美老人巨大xxxx做受 | 人人妻人人澡人人爽人人精品浪潮 | 国产九九九九九九九a片 | 成年美女黄网站色大免费视频 | 99er热精品视频 | 亚洲中文字幕乱码av波多ji | 狠狠色欧美亚洲狠狠色www | 中文无码伦av中文字幕 | 久久99精品国产.久久久久 | 国产亚洲人成在线播放 | 国产精品高潮呻吟av久久4虎 | 国产综合在线观看 | 少女韩国电视剧在线观看完整 | 97se亚洲精品一区 | 国产内射爽爽大片视频社区在线 | 无码人妻久久一区二区三区不卡 | 88国产精品欧美一区二区三区 | 中文无码成人免费视频在线观看 | 黑人粗大猛烈进出高潮视频 | 国产精品久久久久久亚洲影视内衣 | 丰满少妇人妻久久久久久 | 欧美日韩一区二区免费视频 | 国产精品国产自线拍免费软件 | 免费中文字幕日韩欧美 | 国产无遮挡吃胸膜奶免费看 | 性做久久久久久久久 | 婷婷丁香五月天综合东京热 | 欧美怡红院免费全部视频 | 国产绳艺sm调教室论坛 | 无码人妻出轨黑人中文字幕 | 欧美一区二区三区 | 日韩av无码一区二区三区不卡 | 久久人妻内射无码一区三区 | 99在线 | 亚洲 | 国产精华av午夜在线观看 | 精品久久综合1区2区3区激情 | 国产午夜福利100集发布 | 粉嫩少妇内射浓精videos | 天堂在线观看www | 欧美乱妇无乱码大黄a片 | 99久久人妻精品免费一区 | 欧洲极品少妇 | 国产精品亚洲一区二区三区喷水 | 欧美成人午夜精品久久久 | 欧美肥老太牲交大战 | 丰满少妇人妻久久久久久 | 无码国模国产在线观看 | 亚洲中文字幕va福利 | 国产免费久久久久久无码 | 亚洲中文字幕在线无码一区二区 | 国产成人一区二区三区在线观看 | а√资源新版在线天堂 | 亚洲中文字幕成人无码 | 免费人成在线视频无码 | 三上悠亚人妻中文字幕在线 | 成人免费视频视频在线观看 免费 | 少妇邻居内射在线 | 国产人妖乱国产精品人妖 | 玩弄人妻少妇500系列视频 | 国産精品久久久久久久 | 亚洲啪av永久无码精品放毛片 | 国内揄拍国内精品少妇国语 | 最新国产乱人伦偷精品免费网站 | 精品成人av一区二区三区 | 国产无av码在线观看 | 极品尤物被啪到呻吟喷水 | 国产特级毛片aaaaaaa高清 | 午夜精品一区二区三区在线观看 | 麻豆精产国品 | 丰满护士巨好爽好大乳 | 亚洲の无码国产の无码步美 | 麻豆精品国产精华精华液好用吗 | 成人欧美一区二区三区黑人 | 老熟妇乱子伦牲交视频 | 亚洲中文字幕在线无码一区二区 | 久久久久久久久888 | 亚洲无人区一区二区三区 | 荫蒂添的好舒服视频囗交 | 欧美大屁股xxxxhd黑色 | 色狠狠av一区二区三区 | 国精产品一品二品国精品69xx | 国产色精品久久人妻 | 99久久精品午夜一区二区 | 国产suv精品一区二区五 | 亚洲精品一区二区三区在线 | 99久久久无码国产精品免费 | 亚洲国产精品毛片av不卡在线 | 免费观看黄网站 | 激情亚洲一区国产精品 | 欧美 日韩 人妻 高清 中文 | 国产精品美女久久久网av | 国产人妻精品一区二区三区不卡 | 伊人久久大香线蕉亚洲 | av无码电影一区二区三区 | 中文字幕无码热在线视频 | 高潮毛片无遮挡高清免费视频 | 18禁黄网站男男禁片免费观看 | 亚洲国产欧美国产综合一区 | 中文字幕乱妇无码av在线 | 亚洲s色大片在线观看 | 免费乱码人妻系列无码专区 | 久久久久人妻一区精品色欧美 | 国产性猛交╳xxx乱大交 国产精品久久久久久无码 欧洲欧美人成视频在线 | 2019nv天堂香蕉在线观看 | 日韩精品乱码av一区二区 | 欧美性黑人极品hd | 亚洲 激情 小说 另类 欧美 | 亚洲 激情 小说 另类 欧美 | 99视频精品全部免费免费观看 | 精品国产国产综合精品 | 老熟女乱子伦 | 女高中生第一次破苞av | 亚洲国产精品成人久久蜜臀 | 国产在线一区二区三区四区五区 | 亚洲综合久久一区二区 | 国产午夜手机精彩视频 | 欧美熟妇另类久久久久久多毛 | 性欧美疯狂xxxxbbbb | 日本一卡2卡3卡四卡精品网站 | 九九综合va免费看 | 俺去俺来也www色官网 | 夜夜躁日日躁狠狠久久av | 亚洲日韩一区二区 | 欧美黑人性暴力猛交喷水 | 国产精品久久精品三级 | 在线视频网站www色 | 国产成人亚洲综合无码 | 亚洲成av人片在线观看无码不卡 | 国产av久久久久精东av | 久久aⅴ免费观看 | 国产超级va在线观看视频 | a在线亚洲男人的天堂 | 欧美老妇与禽交 | 久久这里只有精品视频9 | 2019午夜福利不卡片在线 | 亚洲欧美色中文字幕在线 | 精品无码av一区二区三区 | 麻豆国产丝袜白领秘书在线观看 | 美女张开腿让人桶 | 永久免费观看美女裸体的网站 | 亚洲无人区午夜福利码高清完整版 | 亚洲男女内射在线播放 | 天堂亚洲2017在线观看 | 鲁大师影院在线观看 | 亚洲欧美日韩国产精品一区二区 | 中文无码伦av中文字幕 | 99久久久国产精品无码免费 | 99久久婷婷国产综合精品青草免费 | 亚洲精品无码人妻无码 | 永久免费观看国产裸体美女 | 国产亚洲日韩欧美另类第八页 | 真人与拘做受免费视频一 | 国产人妻人伦精品 | 一本色道婷婷久久欧美 | 日本精品久久久久中文字幕 | 亚洲国产av精品一区二区蜜芽 | 精品人妻人人做人人爽 | 国产特级毛片aaaaaa高潮流水 | 亚洲精品午夜国产va久久成人 | 亚欧洲精品在线视频免费观看 | 精品国产一区二区三区四区在线看 | 中文字幕无码日韩专区 | 无码精品人妻一区二区三区av | 亚洲国产精品美女久久久久 | 男女超爽视频免费播放 | 国产精品久久久av久久久 | 成人aaa片一区国产精品 | 亚洲精品综合一区二区三区在线 | 国产无遮挡又黄又爽免费视频 | 国产av无码专区亚洲a∨毛片 | 亚洲成熟女人毛毛耸耸多 | 97夜夜澡人人爽人人喊中国片 | 亚洲精品一区国产 | 成人三级无码视频在线观看 | 国产成人无码区免费内射一片色欲 | 欧美性黑人极品hd | 狂野欧美激情性xxxx | 国产成人精品三级麻豆 | av香港经典三级级 在线 | 无码毛片视频一区二区本码 | 少妇无码一区二区二三区 | 伊人久久大香线蕉午夜 | 人妻少妇精品视频专区 | 亚洲欧洲中文日韩av乱码 | 老头边吃奶边弄进去呻吟 | 国产精品18久久久久久麻辣 | 无码人妻精品一区二区三区下载 | 97无码免费人妻超级碰碰夜夜 | 综合人妻久久一区二区精品 | 巨爆乳无码视频在线观看 | 欧美国产日韩久久mv | 亚洲成a人片在线观看无码 | 熟妇激情内射com | 亚洲自偷精品视频自拍 | 久久久成人毛片无码 | 国内揄拍国内精品少妇国语 | 又粗又大又硬又长又爽 | 日本高清一区免费中文视频 | 日韩人妻少妇一区二区三区 | 131美女爱做视频 | 无码人妻少妇伦在线电影 | 欧美35页视频在线观看 | 日韩少妇白浆无码系列 | 亚洲伊人久久精品影院 | 欧美国产亚洲日韩在线二区 | aⅴ亚洲 日韩 色 图网站 播放 | 国产色xx群视频射精 | 久久人人97超碰a片精品 | 国产精品鲁鲁鲁 | 中文字幕无码av激情不卡 | 狠狠躁日日躁夜夜躁2020 | 国内揄拍国内精品少妇国语 | 日韩欧美中文字幕在线三区 | 特黄特色大片免费播放器图片 | 少妇无套内谢久久久久 | 国内揄拍国内精品人妻 | 欧美日韩在线亚洲综合国产人 | 亚洲精品国产第一综合99久久 | 日韩精品久久久肉伦网站 | 欧美丰满熟妇xxxx | 国产成人无码区免费内射一片色欲 | 国产精华av午夜在线观看 | 中文字幕人妻丝袜二区 | 中文字幕人妻无码一区二区三区 | 国产精品美女久久久久av爽李琼 | 狂野欧美激情性xxxx | 激情亚洲一区国产精品 | 97久久超碰中文字幕 | 狠狠色色综合网站 | 丁香花在线影院观看在线播放 | 亚洲自偷自拍另类第1页 | 成人精品视频一区二区三区尤物 | 国产无套粉嫩白浆在线 | 国产午夜亚洲精品不卡下载 | 午夜精品一区二区三区的区别 | 伊人色综合久久天天小片 | 国产做国产爱免费视频 | 亚洲高清偷拍一区二区三区 | 久久国产精品偷任你爽任你 | 亚洲精品一区二区三区大桥未久 | 夜夜高潮次次欢爽av女 | 久久婷婷五月综合色国产香蕉 | 日韩无套无码精品 | 牛和人交xxxx欧美 | 欧美人与禽zoz0性伦交 | 无遮挡国产高潮视频免费观看 | 国产在线精品一区二区高清不卡 | 国产麻豆精品一区二区三区v视界 | 中文久久乱码一区二区 | 国产精品无码一区二区桃花视频 | 国产精品理论片在线观看 | 亚洲精品午夜无码电影网 | 中文无码成人免费视频在线观看 | 精品亚洲成av人在线观看 | 精品国产aⅴ无码一区二区 | 免费播放一区二区三区 | 久久综合激激的五月天 | 亚洲人交乣女bbw | 欧美日韩亚洲国产精品 | 亚洲人成无码网www | 在线观看国产一区二区三区 | 少妇被黑人到高潮喷出白浆 | 丝袜人妻一区二区三区 | 99久久久国产精品无码免费 | 国产热a欧美热a在线视频 | 亚洲性无码av中文字幕 | 久久久无码中文字幕久... | 无码乱肉视频免费大全合集 | 无码av中文字幕免费放 | 亚洲乱码国产乱码精品精 | 亚洲天堂2017无码 | 欧美人与物videos另类 | 一二三四社区在线中文视频 | a片免费视频在线观看 | 无码人妻久久一区二区三区不卡 | 国产深夜福利视频在线 | 男女爱爱好爽视频免费看 | 国产精品va在线播放 | 亚洲精品国产精品乱码不卡 | 久精品国产欧美亚洲色aⅴ大片 | 天堂久久天堂av色综合 | 丰满人妻精品国产99aⅴ | 欧美怡红院免费全部视频 | 水蜜桃色314在线观看 | 亚洲国产精品一区二区美利坚 | 亚洲男人av香蕉爽爽爽爽 | 国产精品手机免费 | 亚洲高清偷拍一区二区三区 | 台湾无码一区二区 | 欧美一区二区三区视频在线观看 | 色综合久久网 | 亚洲乱亚洲乱妇50p | 日本乱人伦片中文三区 | 国产亚洲精品久久久久久国模美 | 老太婆性杂交欧美肥老太 | 未满成年国产在线观看 | 无码一区二区三区在线观看 | 欧美老妇与禽交 | 奇米影视7777久久精品 | 久久久久国色av免费观看性色 | 国产在线精品一区二区高清不卡 | 国产9 9在线 | 中文 | 日本va欧美va欧美va精品 | 久久成人a毛片免费观看网站 | 无码人中文字幕 | 极品嫩模高潮叫床 | 精品国产成人一区二区三区 | 蜜桃臀无码内射一区二区三区 | 又紧又大又爽精品一区二区 | 国产精品18久久久久久麻辣 | 白嫩日本少妇做爰 | 永久免费观看国产裸体美女 | 国模大胆一区二区三区 | 欧洲精品码一区二区三区免费看 | 天下第一社区视频www日本 | 国产麻豆精品一区二区三区v视界 | 亚洲欧美综合区丁香五月小说 | 午夜精品久久久内射近拍高清 | 无套内谢的新婚少妇国语播放 | 99久久99久久免费精品蜜桃 | 无码人妻久久一区二区三区不卡 | 国产suv精品一区二区五 | 欧美性猛交xxxx富婆 | 在教室伦流澡到高潮hnp视频 | 丰满少妇弄高潮了www | 人人妻在人人 | 国产亲子乱弄免费视频 | 国产又粗又硬又大爽黄老大爷视 | 超碰97人人做人人爱少妇 | 乱人伦人妻中文字幕无码久久网 | 日日干夜夜干 | 漂亮人妻洗澡被公强 日日躁 | av人摸人人人澡人人超碰下载 | 免费国产成人高清在线观看网站 | 兔费看少妇性l交大片免费 | 无码av免费一区二区三区试看 | 一二三四在线观看免费视频 | 无遮无挡爽爽免费视频 | 少妇性l交大片 | 免费网站看v片在线18禁无码 | 欧美日本免费一区二区三区 | 一本久道久久综合婷婷五月 | 天堂久久天堂av色综合 | 亚洲啪av永久无码精品放毛片 | 人人妻人人澡人人爽人人精品 | 成人无码视频免费播放 | 亚洲成色在线综合网站 | 国产精品久久久一区二区三区 | 色欲人妻aaaaaaa无码 | 999久久久国产精品消防器材 | 国产精品丝袜黑色高跟鞋 | 亚洲综合伊人久久大杳蕉 | 蜜桃av蜜臀av色欲av麻 999久久久国产精品消防器材 | 狠狠色欧美亚洲狠狠色www | 亚洲va中文字幕无码久久不卡 | 亚洲熟妇色xxxxx欧美老妇 | 色诱久久久久综合网ywww | 日本精品高清一区二区 | 国产va免费精品观看 | 国产人妻久久精品二区三区老狼 | 一本精品99久久精品77 | 最新国产麻豆aⅴ精品无码 | 人妻aⅴ无码一区二区三区 | 欧美人与物videos另类 | 久久亚洲精品中文字幕无男同 | 蜜臀av无码人妻精品 | 帮老师解开蕾丝奶罩吸乳网站 | 色婷婷av一区二区三区之红樱桃 | 亚洲欧美精品aaaaaa片 | 欧洲熟妇精品视频 | 欧美 日韩 人妻 高清 中文 | 77777熟女视频在线观看 а天堂中文在线官网 | 亚洲国产欧美日韩精品一区二区三区 | 亚洲区欧美区综合区自拍区 | 伊人久久大香线蕉av一区二区 | 国产人妻久久精品二区三区老狼 | 少妇邻居内射在线 | 国产成人一区二区三区在线观看 | 麻豆av传媒蜜桃天美传媒 | 内射后入在线观看一区 | 人人澡人摸人人添 | 国产精品沙发午睡系列 | 精品国产麻豆免费人成网站 | 激情内射日本一区二区三区 | 成 人影片 免费观看 | 亚洲人交乣女bbw | 亚洲精品鲁一鲁一区二区三区 | 中文久久乱码一区二区 | a在线观看免费网站大全 | www国产亚洲精品久久网站 | 国产一区二区三区日韩精品 | 亚洲国精产品一二二线 | 久久久中文久久久无码 | 玩弄中年熟妇正在播放 | 狠狠色色综合网站 | 久久久www成人免费毛片 | 亚洲中文字幕在线无码一区二区 | 亚欧洲精品在线视频免费观看 | 在线看片无码永久免费视频 | 无码人妻黑人中文字幕 | 欧美性黑人极品hd | 精品无码国产自产拍在线观看蜜 | 国产成人无码a区在线观看视频app | 激情五月综合色婷婷一区二区 | 少妇的肉体aa片免费 | 日韩视频 中文字幕 视频一区 | 国产农村乱对白刺激视频 | 国产精品高潮呻吟av久久4虎 | 亚洲中文字幕在线无码一区二区 | 日本肉体xxxx裸交 | 日日天干夜夜狠狠爱 | 一本大道伊人av久久综合 | 乱码午夜-极国产极内射 | 免费无码av一区二区 | 午夜性刺激在线视频免费 | 中文字幕人妻丝袜二区 | 无码人妻久久一区二区三区不卡 | 亚洲精品国偷拍自产在线观看蜜桃 | 久久精品中文字幕大胸 | 无套内射视频囯产 | 国产无av码在线观看 | 国产人妻精品午夜福利免费 | 亚洲国产精品一区二区美利坚 | 大肉大捧一进一出视频出来呀 | 国产特级毛片aaaaaa高潮流水 | 亚洲成av人片在线观看无码不卡 | 国产亚洲欧美在线专区 | 日本va欧美va欧美va精品 | 日韩精品无码一本二本三本色 | 人妻无码αv中文字幕久久琪琪布 | 无套内谢的新婚少妇国语播放 | 国产精品高潮呻吟av久久4虎 | 日韩欧美成人免费观看 | 国产农村妇女高潮大叫 | 黑人粗大猛烈进出高潮视频 | 一个人看的视频www在线 | 亚洲日本在线电影 | 精品日本一区二区三区在线观看 | 亚洲最大成人网站 | 国产精品国产三级国产专播 | 在线视频网站www色 | 无码一区二区三区在线观看 | 欧美丰满熟妇xxxx | 性色欲网站人妻丰满中文久久不卡 | 久久久无码中文字幕久... | 一本精品99久久精品77 | 久久久精品欧美一区二区免费 | 国产亲子乱弄免费视频 | 亚洲乱码日产精品bd | 色五月五月丁香亚洲综合网 | 国产又粗又硬又大爽黄老大爷视 | 激情国产av做激情国产爱 | 亚洲区欧美区综合区自拍区 | 人人妻人人澡人人爽人人精品 | 日韩精品无码一本二本三本色 | 亚洲成av人综合在线观看 | 国产亚洲人成在线播放 | 少妇人妻偷人精品无码视频 | 亚无码乱人伦一区二区 | 伊人久久大香线蕉午夜 | 永久黄网站色视频免费直播 | 免费乱码人妻系列无码专区 | 亚洲欧洲日本综合aⅴ在线 | 内射白嫩少妇超碰 | 久久综合激激的五月天 | 国产精品久久久午夜夜伦鲁鲁 | 人人妻人人澡人人爽欧美精品 | 午夜福利不卡在线视频 | 亚洲精品一区三区三区在线观看 | 久久国语露脸国产精品电影 | 国产精品高潮呻吟av久久4虎 | 曰本女人与公拘交酡免费视频 | 国产香蕉尹人综合在线观看 | 熟女俱乐部五十路六十路av | 日本欧美一区二区三区乱码 | 白嫩日本少妇做爰 | 亚洲第一无码av无码专区 | 亚洲熟悉妇女xxx妇女av | 国产 精品 自在自线 | a在线亚洲男人的天堂 | 日本又色又爽又黄的a片18禁 | 美女张开腿让人桶 | 免费网站看v片在线18禁无码 |