aboutsummaryrefslogtreecommitdiff
path: root/system/x86_64/start.S
blob: b31b9b1253a1e5540c8a0d38168818a8ac120fc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
.text
.global _start
_start:
	popq	%rdi			/* %rdi = argc */
	movq	%rsp,%rsi		/* %rsi = argv */
	pushq	%rdi
	
	leaq	8(%rsi,%rdi,8),%rdx	/* %rdx = envp = (8*rdi)+%rsi+8 */

	movq	%rdx, environ(%rip)
	call	main
	movq	%rax, %rdi	/* return value */
	call	exit
	hlt
.Lstart:
	.size	 _start,.Lstart-_start