32 lines
419 B
ArmAsm
32 lines
419 B
ArmAsm
.section .text
|
|
|
|
.global _start
|
|
.extern exit
|
|
.extern libc_init
|
|
_start:
|
|
# Set up end of the stack frame linked list.
|
|
movq $0, %rbp
|
|
pushq %rbp # rip=0
|
|
pushq %rbp # rbp=0
|
|
movq %rsp, %rbp
|
|
|
|
pushq %rsi
|
|
pushq %rdi
|
|
pushq %rcx
|
|
|
|
call libc_init
|
|
|
|
# Run the global constructors.
|
|
call _init
|
|
|
|
popq %rdx
|
|
popq %rdi
|
|
popq %rsi
|
|
|
|
# Run main
|
|
call main
|
|
|
|
# Terminate the process with the exit code.
|
|
movl %eax, %edi
|
|
call exit
|