Assembly language programming under UNIX® is highly
undocumented. It is generally assumed that no one would ever
want to use it because various UNIX systems run on different
microprocessors, so everything should be written in C for
portability. In reality, C portability is quite a myth. Even C
programs need to be modified when ported from one UNIX to
another, regardless of what processor each runs on. Typically,
such a program is full of conditional statements depending on
the system it is compiled for. Even if we believe that all of
UNIX software should be written in C, or some other high-level
language, we still need assembly language programmers: Who else
would write the section of C library that accesses the kernel?
In this chapter I will attempt to show you how you can use
assembly language writing UNIX programs, specifically under
FreeBSD. This chapter does not explain the basics of assembly
language. There are enough resources about that (for a complete
online course in assembly language, see Randall H