diff --git a/components/lwp/arch/risc-v/rv64/lwp_arch.c b/components/lwp/arch/risc-v/rv64/lwp_arch.c index 118e1731058139331c02ca92411bd1a6728d29b8..ef3fc3c17c0f0f5e738b91920daa56e1579e6494 100644 --- a/components/lwp/arch/risc-v/rv64/lwp_arch.c +++ b/components/lwp/arch/risc-v/rv64/lwp_arch.c @@ -190,6 +190,10 @@ void lwp_set_thread_context(void *exit_addr, void *new_thread_stack, void *user_ syscall_frame->a0 = 0; syscall_frame->a1 = 0; + /* reset thread area */ + rt_thread_t thread = rt_container_of((unsigned long)thread_sp, struct rt_thread, sp); + syscall_frame->tp = (rt_ubase_t)thread->thread_idr; + /* build temp thread context */ stk -= sizeof(struct rt_hw_stack_frame); diff --git a/components/lwp/lwp.c b/components/lwp/lwp.c index d7de0e0d9a9b0d478cf7bd5f93387b6334abcbe5..488619250fd0a2c62746ab90766674d47644ad62 100644 --- a/components/lwp/lwp.c +++ b/components/lwp/lwp.c @@ -1333,7 +1333,10 @@ void lwp_user_setting_restore(rt_thread_t thread) { return; } +#if !defined(ARCH_RISCV64) + /* tidr will be set in RESTORE_ALL in risc-v */ rt_cpu_set_thread_idr(thread->thread_idr); +#endif if (rt_dbg_ops) {