diff --git a/platform/airbender.ld b/platform/airbender.ld index 7aa2121..02049e4 100644 --- a/platform/airbender.ld +++ b/platform/airbender.ld @@ -70,7 +70,7 @@ SECTIONS __image_text_end = .; } >rom :text - .rodata ALIGN(8) : { + .rodata : ALIGN(8) { *(.srodata .srodata.*) *(.rodata .rodata.*) } >rom :rodata diff --git a/platform/entry.S b/platform/entry.S index da18fbf..8822974 100644 --- a/platform/entry.S +++ b/platform/entry.S @@ -66,38 +66,32 @@ _start: la sp, _init_stack_top /* Initialised RAM: one block linked to run in RAM and loaded in ROM, which - * the delegations cannot read. Eight words a round, then the rest one by - * one: without .NET's data rehydration the block is hundreds of KiB. */ + * the delegations cannot read. 64 words a round, then the rest one by + * one: without .NET's data rehydration the block is hundreds of KiB, and + * each word takes a load and a store, so the pointer steps and the branch + * are what a longer round saves. */ la t0, __ram_init_load la t1, __ram_init_start la t2, __ram_init_end - addi t4, t2, -32 + addi t4, t2, -256 bgtu t1, t4, 3f -1: lw t3, 0(t0) - lw t5, 4(t0) - lw t6, 8(t0) - lw a2, 12(t0) - lw a3, 16(t0) - lw a4, 20(t0) - lw a5, 24(t0) - lw a6, 28(t0) - sw t3, 0(t1) - sw t5, 4(t1) - sw t6, 8(t1) - sw a2, 12(t1) - sw a3, 16(t1) - sw a4, 20(t1) - sw a5, 24(t1) - sw a6, 28(t1) - addi t0, t0, 32 - addi t1, t1, 32 +1: + .set offset, 0 + .rept 64 + lw t3, offset(t0) + sw t3, offset(t1) + .set offset, offset + 4 + .endr + addi t0, t0, 256 + addi t1, t1, 256 bleu t1, t4, 1b -3: bgeu t1, t2, 2f +3: beq t1, t2, 2f +4: lw t3, 0(t0) sw t3, 0(t1) addi t0, t0, 4 addi t1, t1, 4 - j 3b + bne t1, t2, 4b 2: /* .bss needs no clearing: RAM starts zeroed, in the circuit (its memory * argument fixes the initial value at 0) and in the simulator alike, and diff --git a/tests/platform/airbender-tls.S b/tests/platform/airbender-tls.S index e83dde3..ea389df 100644 --- a/tests/platform/airbender-tls.S +++ b/tests/platform/airbender-tls.S @@ -2,6 +2,9 @@ .global _start _start: j _start +.section .rodata,"a",@progbits + .balign 128 + .word 0x11223344 .section __modules,"aw",@progbits .word 0x12345678 .section .data,"aw",@progbits diff --git a/tests/platform/run-tls.sh b/tests/platform/run-tls.sh index f560d0a..bac1444 100755 --- a/tests/platform/run-tls.sh +++ b/tests/platform/run-tls.sh @@ -10,7 +10,7 @@ trap 'rm -rf "$work_dir"' EXIT clang --target=riscv32-unknown-elf -march=rv32im -mabi=ilp32 \ -c "$test_dir/airbender-tls.S" -o "$work_dir/input.o" -"${BFLAT_LD:-ld.lld}" -static --no-relax \ +"${BFLAT_LD:-ld.lld}" -static --no-relax --fatal-warnings \ -T "$test_dir/../../platform/airbender.ld" \ "$work_dir/input.o" -o "$work_dir/guest" "${BFLAT_OBJCOPY:-llvm-objcopy}" -O binary "$work_dir/guest" "$work_dir/guest.bin"