mirror of
https://github.com/edg-l/edgarluque.com.git
synced 2024-11-09 17:48:22 +00:00
prog
This commit is contained in:
parent
f7c1ca40d3
commit
e400e975f5
|
@ -9,9 +9,38 @@ categories = ["asm", "nasm", "x86_64"]
|
||||||
|
|
||||||
Here is a post I will probably update as I learn more x86_64 assembly.
|
Here is a post I will probably update as I learn more x86_64 assembly.
|
||||||
|
|
||||||
|
# AMD64 ABI Reference
|
||||||
|
|
||||||
|
From left to right, pass as many parameters as will fit in registers. The order in which registers are allocated, are:
|
||||||
|
|
||||||
|
- For non-floats: rdi, rsi, rdx, rcx, r8, r9.
|
||||||
|
- For floating-point: xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7.
|
||||||
|
- Callee saved: rsp, rbx, rbp, r12-r15
|
||||||
|
- Return value: `rax`
|
||||||
|
- Stack pointer: `rsp`
|
||||||
|
- Base pointer: `rbp`
|
||||||
|
|
||||||
|
# Call Frame
|
||||||
|
|
||||||
|
Stack grows downwards.
|
||||||
|
|
||||||
|
```asm
|
||||||
|
caller:
|
||||||
|
push rbp ; save old frame
|
||||||
|
mov rbp, rsp ; init frame
|
||||||
|
; arguments passed in the stack are upwards
|
||||||
|
mov r14, [rbp + 0x10]
|
||||||
|
; ...
|
||||||
|
mov rsp, rbp
|
||||||
|
pop rbp
|
||||||
|
ret
|
||||||
|
```
|
||||||
|
|
||||||
## x86_64 Cheatsheet
|
## x86_64 Cheatsheet
|
||||||
|
|
||||||
|s|b|
|
|s|b|
|
||||||
|---|---|
|
|---|---|
|
||||||
|a|b|
|
|a|b|
|
||||||
|
|a|b|
|
||||||
|
|a|b|
|
||||||
|
|a|b|
|
||||||
|
|
|
@ -209,3 +209,25 @@ h1,h2,h3 {
|
||||||
border-bottom: 4px $color solid;
|
border-bottom: 4px $color solid;
|
||||||
border-bottom-color: #FFAA00;
|
border-bottom-color: #FFAA00;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
margin: 1em 0px;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
table, th, td {
|
||||||
|
border: 1px solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
background-color: #2c2c2c;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
th, td {
|
||||||
|
padding: 10px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr:nth-child(even) {background-color: #1b2127;}
|
||||||
|
|
Loading…
Reference in a new issue