arch: arc: the stack checking should consider the case of SMP

the old codes just work for single core, we need to consider
the case of SMP.

In SMP, it's not easy to get current thread of current cpu in
assembly, so we'd better do it in C.

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
This commit is contained in:
Wayne Ren 2020-03-02 13:45:34 +08:00 committed by Anas Nashif
commit 8975c0a33e
3 changed files with 7 additions and 6 deletions

View file

@ -268,8 +268,8 @@ FUNC_NORETURN void arch_user_mode_enter(k_thread_entry_t user_entry,
configure_mpu_thread(_current);
z_arc_userspace_enter(user_entry, p1, p2, p3,
(u32_t)_current->stack_obj,
_current->stack_info.size);
(u32_t)_current->stack_obj,
_current->stack_info.size, _current);
CODE_UNREACHABLE;
}

View file

@ -123,11 +123,11 @@ _clear_user_stack:
jlt _clear_user_stack
/* reload the stack checking regs as the original kernel stack
* becomess user stack
* becomes user stack
*/
#ifdef CONFIG_ARC_STACK_CHECKING
mov_s r1, _kernel
ld_s r2, [r1, _kernel_offset_to_current]
/* current thread in r6, SMP case is also considered */
mov r2, r6
_load_stack_check_regs

View file

@ -64,7 +64,8 @@ extern void z_thread_entry_wrapper(void);
extern void z_user_thread_entry_wrapper(void);
extern void z_arc_userspace_enter(k_thread_entry_t user_entry, void *p1,
void *p2, void *p3, u32_t stack, u32_t size);
void *p2, void *p3, u32_t stack, u32_t size,
struct k_thread *thread);
extern void arch_switch(void *switch_to, void **switched_from);