In x86-32 you push
arguments to stack, and in x86-64 it also uses some specific registers and only after it the stack. That said, I don't understand why I get Segmentation fault
while trying to print an integer (k
and a
are unused):
global _main
extern _printf
section .data
format: db "%d"
b: dw 10
blen: equ $-b
lenlen: equ $-blen
k: dw 6
section .bss
a: resw 1
section .text
_main:
sub rsp, 8
mov rax, 0
mov rdi, format
mov rsi, b
call _printf
mov rax, 0x2000001
mov rdi, 0
syscall