Files
Toooba/Tests/isa/cheri.S
2026-03-12 18:11:55 +00:00

59 lines
1.1 KiB
ArmAsm

.section .text
.globl _start
.align 4
_start:
cspecialr ct0, 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, 10
# seal the bounded capability
# cspecialr ct1, 4
# li t2, 12
# csetaddr ct1, ct1, t2
# ccseal c2, csp, t2
# Read bounds
cgetbase t3, csp
ld t0, 0(csp)
# derive capability from PCC
# csetaddr c1, ct0, t0
# la t0, tohost
li t1, 1
csd t1, 0(c1)
halt:
wfi
j halt
.globl exit
exit:
j exit
.section .bss
.align 16
stack_bottom:
.space 2048
stack_top: # address = 0x80001000 (for csetaddr)
# --------------------------------------------------
# Data section (NO .bss)
# --------------------------------------------------
# .section .data
# .align 3
# .globl tohost
# .globl fromhost
# tohost:
# .dword 0
#fromhost:
# .dword 0