mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-25 22:34:19 +08:00
feat: arm64: update thread self on sp-switch
This patch improves the atomicity of context switching by ensuring that the stack pointer (sp) and thread self updates occur simultaneously. This enhancement is crucial for maintaining thread safety and preventing potential inconsistencies during context switches. Changes: - Modified `cpuport.h` to use `ARM64_THREAD_REG` for thread self access. - Added an `update_tidr` macro in `context_gcc.S` to streamline thread ID updates. - Adjusted `rt_hw_context_switch_to` and `rt_hw_context_switch` to call `update_tidr`, ensuring atomic updates during context switches. - Cleaned up `scheduler_mp.c` by removing redundant thread self assignments. Signed-off-by: Shell <smokewood@qq.com>
This commit is contained in:
@@ -1069,9 +1069,6 @@ void rt_sched_post_ctx_switch(struct rt_thread *thread)
|
||||
}
|
||||
/* safe to access since irq is masked out */
|
||||
pcpu->current_thread = thread;
|
||||
#ifdef ARCH_USING_HW_THREAD_SELF
|
||||
rt_hw_thread_set_self(thread);
|
||||
#endif /* ARCH_USING_HW_THREAD_SELF */
|
||||
}
|
||||
|
||||
#ifdef RT_DEBUGING_CRITICAL
|
||||
|
||||
Reference in New Issue
Block a user