riscv: Initialize TP register when starting threads
Set TP in exception context so that it gets loaded into the CPU when first running the thread. Set TP for secondary cores to related idle TLS area. Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
8b55af51db
commit
f623571a73
6 changed files with 13 additions and 0 deletions
|
@ -94,6 +94,11 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
|||
stack_init->sp = (ulong_t)(stack_init + 1);
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
|
||||
#if defined(CONFIG_THREAD_LOCAL_STORAGE)
|
||||
stack_init->tp = thread->tls;
|
||||
thread->callee_saved.tp = thread->tls;
|
||||
#endif
|
||||
|
||||
/* Assign thread entry point and mstatus.MPRV mode. */
|
||||
if (IS_ENABLED(CONFIG_USERSPACE)
|
||||
&& (thread->base.user_options & K_USER)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue