Linux Assembly HOWTO

Konstantin Boldyshev

Linux Assembly

    konst@linuxassembly.org

Francois-Rene Rideau

Tunes project

    fare@tunes.org

This is the Linux Assembly HOWTO, version 0.6d. This document describes how to program in assembly language using free programming tools, focusing on development for or from the Linux Operating System, mostly on IA-32 (i386) platform. Included material may or may not be applicable to other hardware and/or software platforms.


Table of Contents
1. Introduction
1.1. Legal Blurb
1.2. Foreword
1.3. Contributions
2. Do you need assembly?
2.1. Pros and Cons
2.1.1. The advantages of Assembly
2.1.2. The disadvantages of Assembly
2.1.3. Assessment
2.2. How to NOT use Assembly
2.2.1. General procedure to achieve efficient code
2.2.2. Languages with optimizing compilers
2.2.3. General procedure to speed your code up
2.2.4. Inspecting compiler-generated code
2.3. Linux and assembly
3. Assemblers
3.1. GCC Inline Assembly
3.1.1. Where to find GCC
3.1.2. Where to find docs for GCC Inline Asm
3.1.3. Invoking GCC to build proper inline assembly code
3.1.4. Macro support
3.2. GAS
3.2.1. Where to find it
3.2.2. What is this AT&T syntax
3.2.3. Intel syntax
3.2.4. 16-bit mode
3.2.5. Macro support
3.3. NASM
3.3.1. Where to find NASM
3.3.2. What it does
3.4. AS86
3.4.1. Where to get AS86
3.4.2. Where to find docs
3.4.3. Using AS86 with BCC
3.5. Other Assemblers
3.5.1. Free Pascal
3.5.2. Win32Forth assembler
3.5.3. SHASM
3.5.4. TDASM
3.5.5. Terse
3.5.6. HLA
3.5.7. TALC
3.5.8. Non-free and/or Non-32bit x86 assemblers
4. Metaprogramming
4.1. External filters
4.1.1. CPP
4.1.2. M4
4.1.3. Macroprocessing with your own filter
4.2. Metaprogramming
4.2.1. Backends from compilers
4.2.2. The New-Jersey Machine-Code Toolkit
4.2.3. TUNES
5. Calling conventions
5.1. Linux
5.1.1. Linking to GCC
5.1.2. ELF vs a.out problems
5.1.3. Direct Linux syscalls
5.1.4. Hardware I/O under Linux
5.1.5. Accessing 16-bit drivers from Linux/i386
5.2. DOS and Windows
5.3. Your own OS
6. Quick start
6.1. Introduction
6.1.1. Tools you need
6.2. Hello, world!
6.2.1. Program layout
6.2.2. NASM (hello.asm)
6.2.3. GAS (hello.S)
6.3. Building an executable
6.3.1. Producing object code
6.3.2. Producing executable
7. Resources
7.1. Pointers
7.2. Mailing list
8. Frequently Asked Questions
A. History
B. Acknowledgements
C. Endorsements
D. GNU Free Documentation License