From 4374966d4e22023b14066c57babcc3c18b6d1b85 Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Tue, 26 Jan 2021 19:05:41 +0800 Subject: [PATCH] freerots: fix rtos_int_exit writing outside ISR stack rtos_int_exit would store RA at an offset of 4 byte from the SP, where the offset should be 0. This caused rtos_int_exit to overwrite variables in bss. --- components/freertos/port/riscv/portasm.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/freertos/port/riscv/portasm.S b/components/freertos/port/riscv/portasm.S index d32103f5f8..33bfc4c044 100644 --- a/components/freertos/port/riscv/portasm.S +++ b/components/freertos/port/riscv/portasm.S @@ -90,9 +90,9 @@ isr_skip_decrement: /* preserve return address and schedule next task */ addi sp,sp,-4 - sw ra, 0x04(sp) + sw ra, 0(sp) call vTaskSwitchContext - lw ra, 0x04(sp) + lw ra, 0(sp) addi sp, sp, 4 /* Clears the switch pending flag */