Parametri
There are sixteen 64-bit registers in x86-64: %rax , %rbx , %rcx , %rdx , %rdi , %rsi , %rbp , %rsp , and %r8-r15 .
Of these, %rax , %rcx , %rdx , %rdi , %rsi , %rsp , and %r8-r11 are considered caller-save registers, meaning that they are not necessarily saved across function calls.
By convention, %rax is used to store a function’s return value, if it exists and is no more than 64 bits long. (Larger return types like structs are returned using the stack.)
Registers %rbx , %rbp , and %r12-r15 are callee-save registers, meaning that they are saved across function calls.
Register %rsp is used as the stack pointer , a pointer to the topmost element in the stack.
Additionally, %rdi , %rsi , %rdx , %rcx , %r8 , and %r9 are used to pass the first six integer or pointer parameters to called functions.
Additional parameters (or large parameters such as structs passed by value) are passed on the stack.
Prologo
pushq %rbp
movq %rsp, %rbp
sub $memoriaallocata, %rsp
Epilogo
# mov %rbp, %rsp
# pop %rbp
# questi due equivalgono a leave
leave
ret