summaryrefslogtreecommitdiffstats
path: root/lib/crt/x86_64/crt0.s
blob: c5a0ba938dd53f9cb4d65879e594b209f4429b6f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
.section .text
.global _start
_start:
    #Setup start of stack frame
    xorq %rbp, %rbp
    pushq %rbp
    pushq %rbp
    movq %rsp, %rbp

    #Save arguments passed to main
    pushq %rdi
    pushq %rsi

    #Setup libc and call global constructors

    #Call main
    call main

    #Exit
    movq %rax, %rdi
    call exit
.size _start, . - _start