add an "endcap" to the kernel region

This works around https://github.com/SpinalHDL/VexRiscv/issues/296
This commit is contained in:
bunnie 2023-01-17 23:07:05 +08:00
parent 3417046e7b
commit b275660a71
2 changed files with 26 additions and 0 deletions

View file

@ -25,6 +25,8 @@ SECTIONS
KEEP(*(.trap.rust));
*(.text .text.*);
KEEP(*(.endcap));
} > REGION_TEXT
.rodata : ALIGN(4)

View file

@ -251,3 +251,27 @@ _xous_syscall_return_result:
flush_mmu:
sfence.vma
ret
/*
Endcap of valid RISC-V code, to ensure speculative reads
past the end of the .text section to not trigger an illegal
instuction opcode. This cap is equal to the width of a cache line,
using the 2-byte RV32C encoding.
*/
.section .endcap, "ax"
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop