Dev Genius

Coding, Tutorials, News, UX, UI and much more related to development

Follow publication

Writing an X86–64 Assembly Language Program

Part VII: Quick Reference

Tony Oreglia
Dev Genius
Published in
3 min readDec 20, 2021

--

Photo by Alexander Schimmeck on Unsplash

This article is more of a reference guide for those learning x86–64 Assembly Language. I hope you find the information and links at the bottom helpful.

This reference guide is part seven of a series

Registers

General-purpose registers — there are 16 general-purpose registers — rax, rbx, rcx, rdx, rbp, rsp, rsi, rdi, r8, r9, r10, r11, r12, r13, r14, r15

  • data- section is used for declaring initialized data or constants
  • bss- section is used for declaring non initialized variables
  • text- section is used for code
  • rdi- first argument
  • rsi- second argument
  • rdx- third argument
  • rcx- fourth argument
  • r8- fifth argument
  • r9- sixth

The first six integer or pointer arguments are passed in registers rdi, rsi, rdx, rcx, r8, r9. r10 is used as a static chain pointer in the case of nested functions.

rax is used as the return value from a function.

The registers rbx, rbp, and r12r15 are preserved registers.

All other registers must be saved by the caller if it wishes to preserve its values.

OPERATIONS

  • ADD- integer add
  • SUB- subtract
  • MUL- unsigned multiply
  • IMUL- signed multiply

--

--

Published in Dev Genius

Coding, Tutorials, News, UX, UI and much more related to development

Written by Tony Oreglia

Fullstack Software Engineer living in Lisbon. I write about coding and productivity. I'm building a secure journaling space at https://jumblejournal.org

Responses (1)

Write a response