Table of Contents

x86_64 Register and Instruction Quick Start

This page contains very basic information on the x86_64 architecture: the register layout and naming and some basic instructions. For more comprehensive information, see the references listed below.

Registers

General-Purpose Registers

The 64-bit versions of the 'original' x86 registers are named:

The registers added for 64-bit mode are named:

These may be accessed as:

Usage during syscall/function call:

See the ABI documentation for reference.

Floating-Point and SIMD Registers

x86_64 also defines a set of large registers for floating-point and single-instruction/multiple-data (SIMD) operations. For details, refer to the Intel or AMD documentation.

Instructions

Starter Kit

These instructions are sufficient to complete the SPO600 Assembler Lab (GAS syntax):

 add %r10,%r11    // add r10 and r11, put result in r11
 add $5,%r10      // add 5 to r10, put result in r10
 call label       // call a subroutine / function / procedure
 cmp %r10,%r11    // compare register r10 with register r11.  The comparison sets flags in the processor status register which affect conditional jumps.
 cmp $99,%r11     // compare the number 99 with register r11.  The comparison sets flags in the processor status register which affect conditional jumps.
 div %r10         // divide rax by the given register (r10), places quotient into rax and remainder into rdx (rdx must be zero before this instruction)
 inc %r10         // increment r10
 jmp label        // jump to label
 je  label        // jump to label if equal
 jne label        // jump to label if not equal
 jl  label        // jump to label if less
 jg  label        // jump to label if greater
 mov %r10,%r11    // move data from r10 to r11
 mov $99,%r10     // put the immediate value 99 into r10
 mov %r10,(%r11)  // move data from r10 to address pointed to by r11
 mov (%r10),%r11  // move data from address pointed to by r10 to r10
 mov %r10,label   // move date from r10 to the address label
 mul %r10         // multiplies rax by r10, places result in rax and overflow in rdx
 push %r10        // push r10 onto the stack
 pop %r10         // pop r10 off the stack
 ret              // routine from subroutine (counterpart to call)
 syscall          // invoke a syscall (in 32-bit mode, use "int $0x80" instead)

Note the syntax:

For the MOV instruction:

Resources