xorl %eax, %eax

Book: Professional Assembly Language

with one comment

The first time I had read this book was in 2005. Since then there were a few times I needed to jump back to it for something I was missing. Recently, I advised a friend willing to learn x86 assembly to read it. Consequently, I’ll post a quick overview of the book to let more people know about it.

Title: Professional Assembly Language
Author: Richard Blum

Chapter 1: What Is Assembly Language?
As the title suggests, this is an introduction which is there to familiarize the reader with instruction code handling from high level languages to lower level, leading to assembly language. Then, R. Blum gives a brief description of opcode mnemonics and similar information essential for understanding what assembly language is.

Chapter 2: The IA-32 Platform
Starting from core components of IA-32 architecture such as control and execution units, registers, flags etc., it moves to more advanced concepts like x87 floating-point, MMX, SIMD, threading, etc. The last section is dedicated to non-Intel processors of the IA-32 family.

Chapter 3: The Tools of the Trade
The third chapter is basically a walk through the various open source utilities such as linkers, compilers, assemblers, profilers, etc. that are valuable for moving on with assembly programming in Linux environments.

Chapter 4: A Sample Assembly Language Program
Beginning from the very essentials, author starts building a basic CPUID sample program written entirely in IA-32 assembly language. Later in this chapter, more details are provided in debugging the latter application as well as using C library functions in an assembly code.

Chapter 5: Moving Data
From this chapter the more juicy parts of this book begin. Author goes through the basics of data sections and symbols to “move” and conditional “move” instructions. The next section is about instructions used for exchanging data and at last, using the acquired knowledge along with the stack segment instructions and registers. At the end of this chapter you can also find a small paragraph dedicated to optimizations for memory access.

Chapter 6: Controlling Execution Flow
In this chapter, the reader is introduced to the instructions that manipulate the instruction pointer. These include jumps, calls, interrupts, various branches, loops, etc. Apart from this, R. Blum also includes high-level conditional branches as well as a couple of optimization tips that could be used in such cases.

Chapter 7: Using Numbers
This is one of the large chapters of this book. It’s aim is to describe the numeric data types such as the available integers, SIMD data types, BCD values, floating-point numbers as well as SSE floating-point numbers.

Chapter 8: Basic Math Functions
As you have probably been expecting, this chapter is about everything from well known arithmetic mathematical functions, to logical operations, BCD packed and unpacked arithmetic, etc.

Chapter 9: Advanced Math Functions
Here the reader will learn how to utilize the processor’s FPU using FPU specific components and instructions to implement advanced mathematical functions such as floating-point functions, trigonometric functions, logarithmic functions, etc. In addition, author provides various optimization tricks which are also FPU specific.

Chapter 10: Working with Strings
Once again, here you can find all the essentials to develop your own string manipulation applications in assembly. This includes moving strings, storing, loading, comparing and scanning.

Chapter 11: Using Functions
After defining some functions written in assembly, you can use this chapter to learn how to pass arguments to them. Author discusses all the techniques used to perform this such as using registers, global data, C style arguments through the stack, etc. He then moves to using separate function files as well as methods used for command line parameters.

Chapter 12: Using Linux System Calls
Since the whole book is Linux oriented, this chapter is truly useful. After a brief overview of the Linux kernel’s parts, you can find details on system calls from basic knowledge like how to use them using either C or directly assembly language, to more advanced concepts like viewing the returned results and tracing.

Chapter 13: Using Inline Assembly
Starting from the basics of the assembly formats, it goes through the extended assembly which is used in applications as inline code giving numerous examples to demonstrates his writings.

Chapter 14: Calling Assembly Libraries
After learning how to develop a working library written in assembly language, the authors guides us through the process of using the library functions in C or C++ applications. Finally, he describes the static linking and the shared libraries features that we can use.

Chapter 15: Optimizing Routines
Beginning with GCC’s optimizations, he moves to more advanced issues such as manual optimizations and various optimizations tricks in all of the basic components of an assembly code.

Chapter 16: Using Files
After explaining the UNIX files and permissions it moves to the actual information of how to to use files (reading, writing, changing access modes, handling errors, etc.) using assembly language. This chapter ends with a section about memory-mapped files.

Chapter 17: Using Advanced IA-32 Features
IA-32 has a few architecture specific features. In the last chapter of this book, you can learn how to utilize various SIMD (MMX, SSE and SSE3) features.

Overall, this book is excellent especially for people who are just entering the world of assembly language programming. Since all of the examples are given in AT&T syntax for Linux platform using open source utilities, it might not be the ideal solution for Windows’ people. Nevertheless, Richard Blum wrote a very easy to follow and well structured book which I suggest to almost everyone asking me for an assembly language introductory book.

Written by xorl

March 5, 2011 at 15:30

Posted in books

One Response

Subscribe to comments with RSS.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s