38 lines
1.3 KiB
ArmAsm
38 lines
1.3 KiB
ArmAsm
.section .bss
|
|
.align 6 # 64-byte alignment helps bounds encoding
|
|
buffer:
|
|
.space 64
|
|
|
|
.section .text
|
|
.globl _start
|
|
_start:
|
|
|
|
# ------------------------------------------------------------
|
|
# 1. Create capability to buffer using DDC (c0)
|
|
# ------------------------------------------------------------
|
|
la t0, buffer
|
|
cincoffset c1, c0, t0 # c1 -> buffer capability
|
|
|
|
# ------------------------------------------------------------
|
|
# 2. Set bounds to first 16 bytes
|
|
# ------------------------------------------------------------
|
|
li t1, 16
|
|
csetbounds c2, c1, t1 # c2 = bounded capability
|
|
|
|
# ------------------------------------------------------------
|
|
# 3. Store value 0x42 into buffer[0] using capability
|
|
# ------------------------------------------------------------
|
|
li t2, 0x42
|
|
csb t2, 0(c2) # capability store byte
|
|
|
|
# ------------------------------------------------------------
|
|
# 4. Load the value back from buffer[0]
|
|
# ------------------------------------------------------------
|
|
clbu t3, 0(c2) # t3 should now contain 0x42
|
|
|
|
# ------------------------------------------------------------
|
|
# 5. Infinite loop (bare-metal halt)
|
|
# ------------------------------------------------------------
|
|
1:
|
|
j 1b
|