corrects saving of floating point registers

The previous implementation always made space for XLEN sized registers, in RV32D this leads to overlaps
This commit is contained in:
alex committed 2026-09-16 08:01:11 +02:00
1 parent 86c9d25b5f
commit fa665fcc2e
14 files changed
+496 -962

No files matched your search

+3 -7
View File
@@ -62,11 +62,7 @@
.global trap_entry
.extern _tx_thread_context_restore
trap_entry:
#if defined(__riscv_float_abi_single) || defined(__riscv_float_abi_double)
addi sp, sp, -65*REGBYTES // Allocate space for all registers - with floating point enabled
#else
addi sp, sp, -32*REGBYTES // Allocate space for all registers - without floating point enabled
#endif
addi sp, sp, -TX_INTERRUPT_FRAME_SIZE
STORE x1, 28*REGBYTES(sp) // Store RA, 28*REGBYTES(because call will override ra [ra is a calle register in riscv])
@@ -75,11 +71,11 @@
csrr a0, mcause
csrr a1, mepc
csrr a2, mtval
addi sp, sp, -8
addi sp, sp, -16 // Keep the C handler stack aligned
STORE ra, 0(sp)
call trap_handler
LOAD ra, 0(sp)
addi sp, sp, 8
addi sp, sp, 16
call _tx_thread_context_restore
// it will nerver return
.weak trap_handler