summaryrefslogtreecommitdiff
path: root/05/test.s
blob: a57a946172b464173b8add732516eb2308a69a3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
.global _start
.global __syscall

__syscall:
	# SysV calling convention:          RDI, RSI, RDX, RCX, R8,  R9, 8(%rsp)
	# Linux syscall calling convention: RAX, RDI, RSI, RDX, R10, R8, R9
	mov %rdi, %rax
	mov %rsi, %rdi
	mov %rdx, %rsi
	mov %rcx, %rdx
	mov %r8, %r10
	mov %r9, %r8
	mov 8(%rsp), %r9
	syscall
	ret
	
_start:
	call main
	mov $60, %eax
	syscall