Skip to content

Commit 858f2db

Browse files
committed
Align jump targets to 4 bytes
We use unconditional jumps to reach these locations but I think the RISC-V unconditional jump cannot express locations that are not aligned to 4 bytes.
1 parent b23a94f commit 858f2db

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

riscv-rt/macros/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,12 +483,14 @@ fn vectored_interrupt_trap(arch: RiscvArch) -> TokenStream {
483483
core::arch::global_asm!(
484484
".section .trap, \"ax\"
485485
486+
.align 4
486487
.global _start_DefaultHandler_trap
487488
_start_DefaultHandler_trap:
488489
addi sp, sp, -{TRAP_SIZE} * {width} // allocate space for trap frame
489490
{store_start} // store trap partially (only register a0)
490491
la a0, DefaultHandler // load interrupt handler address into a0
491492
493+
.align 4
492494
.global _continue_interrupt_trap
493495
_continue_interrupt_trap:
494496
{store_continue} // store trap partially (all registers except a0)

0 commit comments

Comments
 (0)