summaryrefslogtreecommitdiffstats
path: root/src/arch/x86_64/prefix/linuxprefix.S
blob: 20163b8a4186d1a45db016f19158b0221e7a347c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <linux/unistd.h>

	.section ".text"
	.code64
	.globl _start
	.type _start, @function

_start:
	xorq	%rbp, %rbp

	popq	%rdi       // argc -> C arg1
	movq	%rsp, %rsi // argv -> C arg2

	andq	$~15, %rsp // 16-byte align the stack

	call	main

	movq	%rax, %rdi // rc -> syscall arg1
	movq	$__NR_exit, %rax
	syscall

	.size _start, . - _start