arch: riscv: enable FPU of threads in unshared FP mode
In unshared FP mode, only 1 thread can use FPU but kernel doesn't know which one, so riscv arch would enable FPU of each thread. Signed-off-by: Jim Shu <cwshu@andestech.com>
This commit is contained in:
parent
615371900e
commit
1b4dad433f
1 changed files with 4 additions and 0 deletions
|
@ -86,10 +86,14 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
|||
#endif /* CONFIG_PMP_STACK_GUARD */
|
||||
|
||||
#if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING)
|
||||
/* Shared FP mode: enable FPU of threads with K_FP_REGS. */
|
||||
if ((thread->base.user_options & K_FP_REGS) != 0) {
|
||||
stack_init->mstatus |= MSTATUS_FS_INIT;
|
||||
}
|
||||
stack_init->fp_state = 0;
|
||||
#elif defined(CONFIG_FPU)
|
||||
/* Unshared FP mode: enable FPU of each thread. */
|
||||
stack_init->mstatus |= MSTATUS_FS_INIT;
|
||||
#endif
|
||||
|
||||
stack_init->mepc = (ulong_t)z_thread_entry_wrapper;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue