rumpk/apps/subject_entry.S

29 lines
579 B
ArmAsm
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

.section .text._start, "ax"
.global _start
_start:
# 🕵 BSS Clearing
la t0, __bss_start
la t1, __bss_end
1: bge t0, t1, 2f
sd zero, 0(t0)
addi t0, t0, 8
j 1b
2:
fence rw, rw
# Valid Args from Stack (Linux ABI)
ld a0, 0(sp) # argc
addi a1, sp, 8 # argv
# Calculate envp in a2: envp = argv + (argc + 1) * 8
addi t0, a0, 1 # t0 = argc + 1
slli t0, t0, 3 # t0 = (argc + 1) * 8
add a2, a1, t0 # a2 = argv + offset
call main
# Call exit(result)
call exit
1: j 1b