Lecture 004

The Basics About Assembly

Architecture: Instruction Set Architecture (ISA). Parts of processor design for writing assembly. (e.g. registers)

Micro-architecture: implementation of architecture (eg. cache size and core frequency)

Programmer Visible States

Assembly data type

Registers

x86-64 Registers

x86-64 Registers

ALL REGISTER

ALL REGISTER

3 kinds operations in assembly

%rdi: first argument %rsi: second argument %rax: third argument

Basic Instructions

Memory, Stack, Heap Diagram

Memory, Stack, Heap Diagram

movq

movq [Source] [Dest]

Unix: [Source] [Dest] Win: [Dest] [Source]

Possible Combinations:

Combinations

Combinations

Addressing Modes

D(Rb, Ri, S) = (Rb + Ri * S) + D

If above not specified, they are identity (0 or 1 depending on arithmetics)

leaq

leaq [Src], [Dst]

Other Arithmetic Operations

Arithmetic Operations

Arithmetic Operations

One Operand Operations

One Operand Operations

Compilation

Compile layers

Compile layers

Debugger Supports

Debugger Supports

Disassemble: objdump -d sum

Table of Content