riscv: add support for thread local storage
Adds the necessary bits to initialize TLS in the stack area and sets up CPU registers during context switch. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
388725870f
commit
8a79ce1428
6 changed files with 44 additions and 0 deletions
|
@ -30,6 +30,11 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
|||
stack_init->a1 = (ulong_t)p1;
|
||||
stack_init->a2 = (ulong_t)p2;
|
||||
stack_init->a3 = (ulong_t)p3;
|
||||
|
||||
#ifdef CONFIG_THREAD_LOCAL_STORAGE
|
||||
stack_init->tp = (ulong_t)thread->tls;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Following the RISC-V architecture,
|
||||
* the MSTATUS register (used to globally enable/disable interrupt),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue