25786df1094825aa5a4e75a5c4fb8a6f87e45bf8
[lunaix-os.git] / lunaix-os / usr / libc / arch / x86_64 / crt0.S
1 #define __ASM__
2 #include <lunaix/syscallid.h>
3
4 .section .data
5     .global environ
6     environ:
7         .long 0
8
9 .section .text
10     .global _start
11     _start:      
12         xorq %rbp, %rbp
13         
14         movq %rsp, %rax
15         movq (%rax), %rdi
16         leaq 8(%rax), %rsi
17
18         fninit
19         xorq %rax, %rax
20         call main
21         
22     1:
23         movq %rax, %rbx
24         movq $__SYSCALL__exit, %rax
25         int $33
26
27         ud2 // should not reach