90 lines
2.1 KiB
ArmAsm
90 lines
2.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
|
|
|
|
# Read bounds
|
|
# cgetbase t3, csp
|
|
ld t0, 0(csp)
|
|
|
|
# ----------------------------------------------------------------
|
|
|
|
# Use csetaddr to build a stack capability
|
|
li t1, 0x80006000 # fixed top-of-stack address
|
|
csetaddr ca1, ct0, t1
|
|
|
|
# bound it to 8 bytes (size of dword)
|
|
li t1, 8
|
|
csetbounds ca1, ca1, t1
|
|
cincoffsetimm ca1, ca1, 8
|
|
|
|
# Read bounds
|
|
# cgetbase t3, csp
|
|
ld t0, 0(ca1)
|
|
|
|
# ----------------------------------------------------------------
|
|
|
|
# Use csetaddr to build a stack capability
|
|
li t1, 0x80008000 # fixed top-of-stack address
|
|
csetaddr ca2, ct0, t1
|
|
|
|
# bound it to 8 bytes (size of dword)
|
|
li t1, 8
|
|
csetbounds ca2, ca2, t1
|
|
cincoffsetimm ca2, ca2, 6
|
|
|
|
# Read bounds
|
|
# cgetbase t3, csp
|
|
ld t0, 0(ca2)
|
|
|
|
# ----------------------------------------------------------------
|
|
|
|
# Use csetaddr to build a stack capability
|
|
li t1, 0x80009000 # fixed top-of-stack address
|
|
csetaddr ca3, ct0, t1
|
|
|
|
# bound it to 8 bytes (size of dword)
|
|
li t1, 8
|
|
csetbounds ca3, ca3, t1
|
|
cincoffsetimm ca3, ca3, 6
|
|
|
|
# Read bounds
|
|
# cgetbase t3, csp
|
|
ld t0, 0(ca3)
|
|
|
|
# ----------------------------------------------------------------
|
|
# Use csetaddr to build a stack capability
|
|
li t1, 0x80002000 # fixed top-of-stack address
|
|
csetaddr ca4, ct0, t1
|
|
|
|
# bound it to 8 bytes (size of dword)
|
|
li t1, 8
|
|
csetbounds ca4, ca4, t1
|
|
cincoffsetimm ca4, ca4, 1
|
|
|
|
# Read bounds
|
|
# cgetbase t3, csp
|
|
ld t0, 0(ca4)
|
|
|
|
# ----------------------------------------------------------------
|
|
|
|
|
|
# derive capability from PCC
|
|
# csetaddr c1, ct0, t0
|
|
|
|
# la t0, tohost
|
|
li t1, 1
|
|
csd t1, 0(c1)
|
|
|