Skip to content

Commit

Permalink
OS: Fix rt-thread task switch when swi triggered by other harts
Browse files Browse the repository at this point in the history
MCAUSE : 0x18000001
MDCAUSE: 0x1
MEPC   : 0xdeadbeee
MTVAL  : 0xdeadbee8
HARTID : 3
ra: 0x0, tp: 0xfea007a0, t0: 0xdeadbeef, t1: 0xdeadbeef, t2: 0xdeadbeef, t3: 0xdeadbeef, t4: 0xdeadbeef, t5: 0xdeadbeef, t6: 0xdeadbeef
a0: 0xdeadbeef, a1: 0xdeadbeef, a2: 0xdeadbeef, a3: 0xdeadbeef, a4: 0xdeadbeef, a5: 0xdeadbeef, a6: 0xdeadbeef, a7: 0xdeadbeef
cause: 0x18000001, epc: 0xdeadbeee
msubm: 0x80

Signed-off-by: Huaqi Fang <578567190@qq.com>
  • Loading branch information
fanghuaqi committed Dec 22, 2022
1 parent 66f6ef4 commit 7251978
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions OS/RTThread/libcpu/risc-v/nuclei/cpuport.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ void xPortTaskSwitch(void)
/* Clear Software IRQ, A MUST */
SysTimer_ClearSWIRQ();
rt_thread_switch_interrupt_flag = 0;
// make from thread to be to thread
// If there is another swi interrupt triggered by other harts
// not through rt_hw_context_switch or rt_hw_context_switch_interrupt
// the task switch should just do a same task save and restore
rt_interrupt_from_thread = rt_interrupt_to_thread;
}

void vPortSetupTimerInterrupt(void)
Expand Down

0 comments on commit 7251978

Please sign in to comment.