Skip to content

Instantly share code, notes, and snippets.

@fbs
Created March 3, 2011 21:06
Show Gist options
  • Select an option

  • Save fbs/853557 to your computer and use it in GitHub Desktop.

Select an option

Save fbs/853557 to your computer and use it in GitHub Desktop.
extern printf
section .rodata ; data section
pstr: db "rax = %d",10,0 ; rax = %d\n\0
num: dq 5
section .text ; code section
global main ; make label available to linker
main: ; standard gcc entry point
push rbp
mov rbp, rsp
mov qword rax, [num]
; push pstr
; push rax
mov rsi, 5
mov rdi, pstr
call printf
add rsp, 24
mov rsp, rbp
pop rbp
mov rax, 0
ret
leave
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment