This is a sort of tutorial on programming in assembly using
the x86-64 or amd64 instruction set valid for AMD64 and EM64T
processors. It is not being updated anymore ! If you're looking for .so injection into another
application please look at Hotpatch .

It is advisable you have a copy of the instruction manuals at
your disposal. It is assumed that you are familiar with the
x86-64 instruction set. Familiarity takes time and it comes with
practice, and of course reading the instruction manuals. But you
have to start somewhere. This tutorial is for application
programming.

The x86-64 processor has the following sixteen 64-bit general
purpose registers: RAX, RBX, RCX, RDX, RDI, RSI, RBP, RSP, R8, R9 , R10, R11,
R12, R13, R14, R15. The eight 80-bit floating point registers are from ST(0)-ST(7). These floating point registers overlap with the eight 64 bit
media registers MMX0-MMX7. There are sixteen 128-bit media registers XMM0-XMM15 as well. There also exist two other 64-bit registers, the
instruction pointer RIP and the conditional flags register RFLAGS.

From the x86-64 ABI , the general purpose registers are used to pass
arguments to functions.

Here are a set of sample programs in x86-64 assembly. The YASM assembler has been used to compile the programs. The operating
system is Slamd64 a GNU/Linux distribution for the x86-64
architecture with the Linux kernel version 2.6.14. The code will
work with any x86-64 GNU/Linux operating system with kernel
2.6.