aboutsummaryrefslogtreecommitdiff
path: root/src/main.s
blob: 4940d01fa9c3104e7a28da81d05c301bc9f6ef7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
.section .text
.globl _start
_start:

    # Open file
    movq 16(%rsp), %rdi # Select first argument as file name
    movq $0, %rsi       # Select read only
    movq $0, %rdx       # Unused mode for read only
    movq $2, %rax       # Select open syscall
    syscall             # Open file, file descriptor returned in rax

    movq %rax, %rdi     # Save file descriptor in r15
    call parse_file

    movq $60, %rax      # Select exit syscall
    movq $0, %rdi       # Exit code 0
    syscall