andersch.dev

<2023-04-10 Mon>

x86

x86 (also known as 8086) is a family of complex instruction set computer (CISC) instruction set architectures created by Intel. The x86 assembly language produces object code for the x86 class of processors.

While the original 8086 was 16-bit, x86 now refers most commonly to 32-bit based systems. It was later extended to 64-bit architectures by AMD as amd64, but is most commonly referred to as x8664.

Hello World in x86 assembly

BITS 64

%define SYS_exit 60
%define SYS_write 1
%define STDOUT 1

segment .text
global _start
_start:
    mov rax, SYS_write
    mov rdi, STDOUT
    mov rsi, buf
    mov rdx, buf_sz
    syscall

    mov rax, SYS_exit
    mov rdi, 0
    syscall

segment .data
buf: db "Hello World", 10
buf_sz: equ $-buf

Terminology

  • Real mode: the mode x86 processors start in
  • Protected mode: mode with 32-bit support, paging and multitasking. Supports 16-bit and 32-bit sub-modes.
  • Long mode: mode with 64-bit support. Supports 16-bit, 32-bit and 64-bit sub-modes.
  • 80x86, x86: the line of 8086-compatible processors. Sometimes means the same thing as IA-32.
  • i386: the line of 80386-compatible processors. Sometimes means the same thing as IA-32.
  • IA-32, i386, 386, x86: 80386-compatible 32-bit ISA
  • IA-64: Not important
  • x86-64, x86_64, x64, AMD64, Intel 64, IA-32e, EM64T - 64-bit x86 ISA.

Resource