<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>x86-64 AT&amp;T on monjiapawne</title><link>https://monjiapawne.github.io/blog/docs/x86-64/</link><description>Recent content in x86-64 AT&amp;T on monjiapawne</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 22 Apr 2026 21:19:13 -0400</lastBuildDate><atom:link href="https://monjiapawne.github.io/blog/docs/x86-64/index.xml" rel="self" type="application/rss+xml"/><item><title>cheatsheet</title><link>https://monjiapawne.github.io/blog/docs/x86-64/cheatsheet/</link><pubDate>Wed, 22 Apr 2026 21:19:13 -0400</pubDate><guid>https://monjiapawne.github.io/blog/docs/x86-64/cheatsheet/</guid><description>&lt;h1 id="x86-64-att-syntax"&gt;x86-64 (AT&amp;amp;T Syntax)&lt;a class="anchor" href="#x86-64-att-syntax"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;hr&gt;
&lt;h2 id="registers"&gt;Registers&lt;a class="anchor" href="#registers"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id="general-purpose"&gt;General Purpose&lt;a class="anchor" href="#general-purpose"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Register&lt;/th&gt;
 &lt;th&gt;64&lt;/th&gt;
 &lt;th&gt;32&lt;/th&gt;
 &lt;th&gt;16&lt;/th&gt;
 &lt;th&gt;8&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;accumulator&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%rax&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%eax&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%ax&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%al&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;base&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%rbx&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%ebx&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%bx&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%bl&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;counter&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%rcx&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%ecx&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%cx&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%cl&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;data&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%rdx&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%edx&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%dx&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%dl&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;source index&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%rsi&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%esi&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%si&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%sil&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;dest index&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%rdi&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%edi&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%di&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%dil&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;stack pointer&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%rsp&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;—&lt;/td&gt;
 &lt;td&gt;—&lt;/td&gt;
 &lt;td&gt;—&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;base pointer&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%rbp&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;—&lt;/td&gt;
 &lt;td&gt;—&lt;/td&gt;
 &lt;td&gt;—&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;extended&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%r8&lt;/code&gt;–&lt;code&gt;%r15&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%r8d&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%r8w&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;%r8b&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id="size-suffixes-gnu"&gt;Size Suffixes (GNU)&lt;a class="anchor" href="#size-suffixes-gnu"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;q&lt;/code&gt; — 8 bytes&lt;/li&gt;
&lt;li&gt;&lt;code&gt;l&lt;/code&gt; — 4 bytes&lt;/li&gt;
&lt;li&gt;&lt;code&gt;w&lt;/code&gt; — 2 bytes&lt;/li&gt;
&lt;li&gt;&lt;code&gt;b&lt;/code&gt; — 1 byte&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id="caller-saved"&gt;Caller-Saved&lt;a class="anchor" href="#caller-saved"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;registers the caller must save if needed after a call&lt;/p&gt;</description></item><item><title>resources</title><link>https://monjiapawne.github.io/blog/docs/x86-64/resources/</link><pubDate>Wed, 22 Apr 2026 21:19:13 -0400</pubDate><guid>https://monjiapawne.github.io/blog/docs/x86-64/resources/</guid><description>&lt;h1 id="resources"&gt;resources&lt;a class="anchor" href="#resources"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id="syscalls"&gt;Syscalls&lt;a class="anchor" href="#syscalls"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.chromium.org/chromium-os/developer-library/reference/linux-constants/syscalls/"&gt;chromium docs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="registers"&gt;Registers&lt;a class="anchor" href="#registers"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://go.dev/src/cmd/compile/abi-internal#amd64-architecture"&gt;https://go.dev/src/cmd/compile/abi-internal#amd64-architecture&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://wiki.osdev.org/CPU_Registers_x86-64"&gt;https://wiki.osdev.org/CPU_Registers_x86-64&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="instructions"&gt;Instructions&lt;a class="anchor" href="#instructions"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://ref.x86asm.net/coder64-abc.html"&gt;http://ref.x86asm.net/coder64-abc.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learning.oreilly.com/library/view/learn-to-program/9781484274378/html/514232_1_En_24_Chapter.xhtml"&gt;https://learning.oreilly.com/library/view/learn-to-program/9781484274378/html/514232_1_En_24_Chapter.xhtml&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="glibc"&gt;glibc&lt;a class="anchor" href="#glibc"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://sourceware.org/glibc/manual/2.43/html_mono/libc.html#Streams"&gt;https://sourceware.org/glibc/manual/2.43/html_mono/libc.html#Streams&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="books"&gt;Books&lt;a class="anchor" href="#books"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;figure&gt;&lt;a href="https://learning.oreilly.com/library/view/learn-to-program/9781484274378/"&gt;&lt;img src="https://monjiapawne.github.io/blog/images/jonathanbarlett.png"
 alt="asm book" width="200"&gt;&lt;/a&gt;
&lt;/figure&gt;

&lt;ul&gt;
&lt;li&gt;Learn to Program with Assembly: Foundational Learning for New Programmers - Jonathan Bartlett&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>concepts</title><link>https://monjiapawne.github.io/blog/docs/x86-64/concepts/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://monjiapawne.github.io/blog/docs/x86-64/concepts/</guid><description>&lt;h1 id="x86-64-att-syntax"&gt;x86-64 (AT&amp;amp;T Syntax)&lt;a class="anchor" href="#x86-64-att-syntax"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id="abi"&gt;ABI&lt;a class="anchor" href="#abi"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;ABI - Application Binary Interface is a type of convention for function calls, similar to how there is for syscalls.
The ABI that linux uses is called - &lt;strong&gt;System V ABI&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote class='book-hint '&gt;
&lt;p&gt;&lt;strong&gt;Q:&lt;/strong&gt; Why do I care? Why should I follow their convention?&lt;/p&gt;
&lt;/blockquote&gt;&lt;p&gt;It allows you to call functions written by other people, even in other programming languages and allows you to estimate the behavior and safety of your registers/stack.&lt;/p&gt;</description></item><item><title>examples</title><link>https://monjiapawne.github.io/blog/docs/x86-64/examples/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://monjiapawne.github.io/blog/docs/x86-64/examples/</guid><description>&lt;h1 id="examples"&gt;Examples&lt;a class="anchor" href="#examples"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id="glibc-function-call-fprintf"&gt;glibc function call fprintf&lt;a class="anchor" href="#glibc-function-call-fprintf"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#000;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-gas" data-lang="gas"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#0f0"&gt;# Prints &amp;#34;25&amp;#34; to stdout
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#0f0"&gt;# build: gcc -static print_example.s
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;.globl &lt;span style="color:#7fffd4"&gt;main&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;.section &lt;span style="color:#7fffd4"&gt;.data&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;fmt_int:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; .ascii &lt;span style="color:#87ceeb"&gt;&amp;#34;%d\n\0&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;.section &lt;span style="color:#7fffd4"&gt;.text&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;main:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ff0"&gt;movq&lt;/span&gt; &lt;span style="color:#7fffd4"&gt;stdout&lt;/span&gt;, &lt;span style="color:#eedd82"&gt;%rdi&lt;/span&gt; &lt;span style="color:#0f0"&gt;# arg1: FILE* stdout 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ff0"&gt;movq&lt;/span&gt; &lt;span style="color:#7fffd4"&gt;$fmt_int&lt;/span&gt;, &lt;span style="color:#eedd82"&gt;%rsi&lt;/span&gt; &lt;span style="color:#0f0"&gt;# arg2: format string
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ff0"&gt;movq&lt;/span&gt; &lt;span style="color:#7fffd4"&gt;$25&lt;/span&gt;, &lt;span style="color:#eedd82"&gt;%rdx&lt;/span&gt; &lt;span style="color:#0f0"&gt;# arg3: integer to print
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ff0"&gt;movq&lt;/span&gt; &lt;span style="color:#7fffd4"&gt;$0&lt;/span&gt;, &lt;span style="color:#eedd82"&gt;%rax&lt;/span&gt; &lt;span style="color:#0f0"&gt;# no floating-point args (required by ABI)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ff0"&gt;call&lt;/span&gt; &lt;span style="color:#7fffd4"&gt;fprintf&lt;/span&gt; &lt;span style="color:#0f0"&gt;# fprintf(stdout, &amp;#34;%d\n&amp;#34;, 25)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ff0"&gt;mov&lt;/span&gt; &lt;span style="color:#7fffd4"&gt;$0&lt;/span&gt;, &lt;span style="color:#eedd82"&gt;%rax&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ff0"&gt;ret&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item></channel></rss>