Linux Assembly Language Programming


This page discusses issues of interest to those who write assembly language programs for the Linux operating system. This page is a bit more technically oriented; this material is not specifically suited for those who are just learning assembly language (or just learning Linux, for that matter). If you're interested in learning assembly language and you want to learn it using the Linux operating system, check out "The Art of Assembly Language Programming, 32-bit/Linux Edition". The Art of Assembly Language will gently guide you through the wonderful world of assembly language programming under Linux. When you complete that text, you'll be ready to attack the material found on this page.

If you're looking for a free assembler to use under Linux, check out the "High Level Assembler" (HLA) which is now available for the Linux operating system. HLA is available free here on Webster. For more information about the High-Level Assembler, Click Here.

Linux System Calls
for Assembly Language Programmers

The HLA Standard Library shields HLA programmers from having to worry about the particular semantics of the underlying operating system calls. Indeed, carefully written HLA programs that make HLA Standard Library calls are portable between Windows and Linux with nothing more than a recompile.

Advanced programmers, however, will need to access operating facilities that the HLA Standard Library just doesn't provide. Assembly language programmers writing Linux code, for example, may need to make Linux-specific calls within their applications. Fortunately, the HLA Standard Library does include a Linux system call module that provides hundreds of wrapper functions, macros, constants, and data types of use to the Linux assembly language programmer. This raises several questions, however, like "what system calls are available?" "How do you call Linux APIs from an assembly program?" "How do you pass parameters to such API functions?" and "What do these system functions do?" By reading the HLA "linux.hhf" header file, you can get a good idea of the types of API functions available and you can use Linux' man pages to find out more information about those functions. Unfortunately, Linux' man pages were written for C programmers, not assembly programmers. So the documentation, while useful, isn't as good as it could be for an assembly language programmer. Furthermore, having to constantly run the man utility everytime you want to get some information about a system call is a real pain in the rear. To solve these problems, Webster provides the document "Linux System Calls for HLA Programmers" (Though this document was written specifically for the HLA assembler, users of other assemblers will find this document useful too).

This 200+ page document lists a large number of Linux system calls, provides an assembly language template (wrapper function) for each API function, and describes the use of that function in assembly (HLA), not C terms. Assembly language programmers will definitely want to refer to this documentation when writing Linux code. Check for updates frequently as new Linux programming information will be added to this document from time to time.

Linux System Calls for Assembly Language (HLA) Programmers (PDF)

Linux Device Drivers in Assembly Language

Allessandro Rubini & Jonathon Corbet have written this fantastic book about Linux device drivers (Linux Device Drivers, Second Edition, O'Reilly & Associates, ISBN 0-596-00008-1). The only problem with this text is that it was written for C programmers and some people need (or simply want) to write the Linux device drivers in assembly language.

Fortunately for those who want to write assembly language device drivers, Rubini & Corbet have released Linux Device Drivers, Second Edition under the GNU Free Documentation License v1.1. This license allows for a translation of the text and its examples from the C language to assembly language. That translation is currently in progress and as chapters of the translation become available, they will appear here on Webster.

So if you want to learn how to write assembly language device drivers under Linux, or if you really want to learn the low-level implementation details, check back here regularly for more chapters in the text!

 Download the sample device driver software
ldd.tar.gz File
 Read the entire text
PDF File
 Table of Contents
PDF File
 Chapter One: Foreword & Introduction
PDF File
 Chapter Two: The Building and Running Modules
PDF File
 Chapter Three: Character Devices
PDF File