v/vlib/os/bare/bare.S

40 lines
786 B
ArmAsm
Raw Normal View History

2019-11-14 05:08:11 +01:00
.intel_syntax noprefix
.text
2019-11-16 09:10:38 +01:00
.globl _start, main__syscall5
2019-11-14 05:08:11 +01:00
_start:
xor rbp,rbp
pop rdi
mov rsi,rsp
and rsp,-16
2019-11-14 08:23:44 +01:00
call main__main
2019-11-14 05:08:11 +01:00
mov rdi,rax /* syscall param 1 = rax (ret value of main) */
mov rax,60 /* SYS_exit */
syscall
ret /* should never be reached, but if the OS somehow fails
to kill us, it will cause a segmentation fault */
2019-11-16 09:10:38 +01:00
main__syscall5:
2019-11-14 05:08:11 +01:00
mov rax,rdi
mov rdi,rsi
mov rsi,rdx
mov rdx,rcx
mov r10,r8
mov r8,r9
syscall
ret
2019-11-16 09:10:38 +01:00
main__syscall6:
2019-11-15 01:17:47 +01:00
mov rax,rdi
mov rdi,rsi
mov rsi,rdx
mov rdx,rcx
mov r10,r8
mov r8,r9
mov r9, [rsp+8]
syscall
ret