Files
Toooba/Tests/isa/CPrograms/start.S
2026-03-21 18:39:01 +00:00

41 lines
1011 B
ArmAsm

.section .text
.globl _start
.align 4
_start:
cspecialr c1, pcc
# Use csetaddr to build a stack capability
li t0, 0x80001000 # fixed top-of-stack address
csetaddr csp, ct0, t0
# bound it to 8 bytes (size of dword)
# li t2, 8
# csetbounds csp, csp, t2
# li t5, 4
# cincoffsetimm csp, csp, 5
# Read bounds
# cgetbase t3, csp
# ld t0, 0(csp)
# derive capability from PCC
# csetaddr c1, ct0, t0
# cspecialr ca0, pcc # Get the root data capability
# li t0, 0x80002000 # Set top of stack address
# csetaddr csp, ca0, t0 # Set address
# li t1, -2048 # 2KB size
# csetbounds csp, csp, t1 # Restrict bounds so main can't wander
# cincoffsetimm csp, csp, 12
# Call main
# sw ra, 12(sp)
call main
# a0 contains return value
mv t1, a0
# la t0, tohost
# Signal success
la t0, 0
li t1, 1
sd t1, 0(t0)