x64 (64-bit)
https://cs.brown.edu/courses/cs033/docs/guides/x64_cheatsheet.pdf
x64 also known as x86-64, AMD64 or Intel 64 is the 64-bit architecture.
1. Little Endian
The least significant byte is stored at the lowest address, and the most signifcant byte is stored at the highest address
Eg. Suppose we want to store 0x44332211 in memory. In this case 0x11 is the least significant byte portion, while 0x44 is the most significant byte:
Image taken directly from source

2. Stack grows toward lower memory addresses
a. The stack grows from high to low addresses
The RSP moves to lower addresses to allocate space for new values (RSP value decremented)
Value is written from lower to higher addresses
Eg. 0x123456: 0x56 written first at the lowest memory address (LSB), followed by 0x34 and 0x12 at the highest address (MSB)
Due to little endianess, the LSB and MSB are written at the lower and higher memory addresses respectively
3. Registers
3.1 Special registers
a. RIP: Register Instruction Pointer
Stores the address of the current machine instruction
b. RBP: Register Base Pointer
Stores the address of the higher address of the current stack frame
This can be the top or bottom of the stack layout when drawn visually (depending on the on how it is drawn)
Used to create a stable reference point
used as an offset to reference local variables
c. RSP: Register Stack Pointer
Stores the address of the lower address of the current stack frame
This can be the top or bottom of the stack layout when drawn visually (depending on the on how it is drawn)
3.2 General-purpose registers
caller-save/callee-owned: values are NOT necessarily saved across functions
caller-owned/callee-save: values are saved across functions
a. rax (callee-owned/caller-save)
Return value from function
b. rdi, rsi, rdx, rcx, r8, r9 (callee-owned/caller-save)
1st to 6th argument (integer/pointer parameter) to called functions
Last updated