/* This is called from z_riscv_context_switch(). FPU access may be granted only if exception level is 0. If we switch to a thread that is still in some exception context then FPU access would be re-evaluated at exception exit time via z_riscv_fpu_exit_exc().  */
void z_riscv_fpu_thread_context_switch(void)
/* This is called from z_riscv_context_switch(). FPU access may be granted only if exception level is 0. If we switch to a thread that is still in some exception context then FPU access would be re-evaluated at exception exit time via z_riscv_fpu_exit_exc().  */
void z_riscv_fpu_thread_context_switch(void)
{
	if (fpu_access_allowed(0)) {
		csr_clear(mstatus, MSTATUS_FS);
		csr_set(mstatus, _current_cpu->arch.fpu_state);
	} else {
		z_riscv_fpu_disable();
	}
}