2019-11-14 07:08:11 +03:00
|
|
|
.intel_syntax noprefix
|
|
|
|
.text
|
2019-11-16 11:10:38 +03:00
|
|
|
.globl _start, main__syscall5
|
2019-11-14 07:08:11 +03:00
|
|
|
|
|
|
|
_start:
|
|
|
|
xor rbp,rbp
|
|
|
|
pop rdi
|
|
|
|
mov rsi,rsp
|
|
|
|
and rsp,-16
|
2019-11-14 10:23:44 +03:00
|
|
|
call main__main
|
2019-11-14 07:08:11 +03:00
|
|
|
|
|
|
|
mov rdi,rax /* syscall param 1 = rax (ret value of main) */
|
|
|
|
mov rax,60 /* SYS_exit */
|
|
|
|
syscall
|
|
|
|
|
|
|
|
ret /* should never be reached, but if the OS somehow fails
|
|
|
|
to kill us, it will cause a segmentation fault */
|
|
|
|
|
2019-11-16 11:10:38 +03:00
|
|
|
main__syscall5:
|
2019-11-14 07:08:11 +03:00
|
|
|
mov rax,rdi
|
|
|
|
mov rdi,rsi
|
|
|
|
mov rsi,rdx
|
|
|
|
mov rdx,rcx
|
|
|
|
mov r10,r8
|
|
|
|
mov r8,r9
|
|
|
|
syscall
|
|
|
|
ret
|
|
|
|
|
2019-11-16 11:10:38 +03:00
|
|
|
main__syscall6:
|
2019-11-15 03:17:47 +03:00
|
|
|
mov rax,rdi
|
|
|
|
mov rdi,rsi
|
|
|
|
mov rsi,rdx
|
|
|
|
mov rdx,rcx
|
|
|
|
mov r10,r8
|
|
|
|
mov r8,r9
|
|
|
|
mov r9, [rsp+8]
|
|
|
|
syscall
|
|
|
|
ret
|
|
|
|
|