aboutsummaryrefslogtreecommitdiff
path: root/user/lib/libc/entry.S
blob: e642fe43844aa136ad4f13065253e61f54de3b4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#ifndef __DYNAMIC__

.globl __libc_static_entry

__libc_static_entry:
	add $8, %rsp       /* Make sure when we overwrite dummy return address
	                      with the correct one, so args will be in the right
	                      place when we call main */
    movq (%rsp), %rdi  /* Copy arguments from stack into registers */
    movq 8(%rsp), %rsi
    movq 16(%rsp), %rdx
    movq 24(%rsp), %rcx
	call main
	mov %rax, %rdi
	call exit

#endif