arch: arc: fix the bug of "wait for switch" sychronization

after applying commit 3235451880, arc's arch_switch also need's
corresponding fix.

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
This commit is contained in:
Wayne Ren 2020-02-03 20:54:36 +08:00 committed by Anas Nashif
commit 34b033d41d

View file

@ -67,15 +67,12 @@ SECTION_FUNC(TEXT, arch_switch)
#endif
/*
* r0 = new_thread->switch_handle = switch_to thread,
* r1 = &old_thread->switch_handle = &switch_from thread
* r1 = &old_thread->switch_handle
* get old_thread from r1
*/
ld_s r2, [r1]
/*
* r2 may be dummy_thread in z_cstart, dummy_thread->switch_handle
* must be 0
*/
breq r2, 0, _switch_to_target_thread
sub r2, r1, ___thread_t_switch_handle_OFFSET
st _CAUSE_COOP, [r2, _thread_offset_to_relinquish_cause]
@ -99,6 +96,13 @@ SECTION_FUNC(TEXT, arch_switch)
_save_callee_saved_regs
#ifdef CONFIG_SMP
/* save old thread into switch handle which is required by
* wait_for_switch
*/
st r2, [r2, ___thread_t_switch_handle_OFFSET]
#endif
#ifdef CONFIG_ARC_STACK_CHECKING
/* disable stack checking here, as sp will be changed to target
* thread'sp
@ -112,8 +116,6 @@ SECTION_FUNC(TEXT, arch_switch)
#endif
#endif
_switch_to_target_thread:
mov_s r2, r0
/* entering here, r2 contains the new current thread */