Lines Matching +full:t +full:- +full:v

5  * SPDX-License-Identifier: Apache-2.0
25 * Note: Apparently gcc doesn't use float regs with variadic functions on
26 * RISC-V even if -mabi is used with f or d so this precaution might be
35 unsigned int v; in DBG() local
38 buf[3] = '0' + _current_cpu->id; in DBG()
39 buf[8] = '0' + arch_current_thread()->arch.exception_depth; in DBG()
40 strcat(buf, arch_current_thread()->name); in DBG()
44 strcat(buf, th->name); in DBG()
46 v = *(unsigned char *)&th->arch.saved_fp_context; in DBG()
49 *p++ = ((v >> 4) < 10) ? ((v >> 4) + '0') : ((v >> 4) - 10 + 'a'); in DBG()
50 *p++ = ((v & 15) < 10) ? ((v & 15) + '0') : ((v & 15) - 10 + 'a'); in DBG()
54 k_str_out(buf, p - buf); in DBG()
59 static inline void DBG(char *msg, struct k_thread *t) { } in DBG() argument
73 _current_cpu->arch.fpu_state = (status & MSTATUS_FS); in z_riscv_fpu_disable()
85 atomic_ptr_set(&_current_cpu->arch.fpu_owner, arch_current_thread()); in z_riscv_fpu_load()
89 z_riscv_fpu_restore(&arch_current_thread()->arch.saved_fp_context); in z_riscv_fpu_load()
95 * then we know the in-memory copy is up to date and skip the FPU content
108 struct k_thread *owner = atomic_ptr_get(&_current_cpu->arch.fpu_owner); in arch_flush_local_fpu()
111 bool dirty = (_current_cpu->arch.fpu_state == MSTATUS_FS_DIRTY); in arch_flush_local_fpu()
117 z_riscv_fpu_save(&owner->arch.saved_fp_context); in arch_flush_local_fpu()
121 owner->arch.fpu_recently_used = dirty; in arch_flush_local_fpu()
127 atomic_ptr_clear(&_current_cpu->arch.fpu_owner); in arch_flush_local_fpu()
150 if (i == _current_cpu->id) { in flush_owned_fpu()
199 * short and don't have persistent register contexts when they're done so
201 * don't get interrupted that is. To ensure that we mask interrupts to
209 __ASSERT((esf->mstatus & MSTATUS_FS) == 0 && in z_riscv_fpu_trap()
216 if (arch_current_thread()->arch.exception_depth > 0) { in z_riscv_fpu_trap()
220 * by disabling IRQs as we wouldn't be able to preserve the in z_riscv_fpu_trap()
223 esf->mstatus &= ~MSTATUS_MPIE_EN; in z_riscv_fpu_trap()
226 esf->mstatus |= MSTATUS_FS_INIT; in z_riscv_fpu_trap()
233 * Make sure the FPU context we need isn't live on another CPU. in z_riscv_fpu_trap()
240 esf->mstatus |= MSTATUS_FS_CLEAN; in z_riscv_fpu_trap()
251 * If current thread doesn't own the FP regs then it will trap on its
259 if (arch_current_thread()->arch.exception_depth == exc_update_level) { in fpu_access_allowed()
260 /* We're about to execute non-exception code */ in fpu_access_allowed()
261 if (_current_cpu->arch.fpu_owner == arch_current_thread()) { in fpu_access_allowed()
265 if (arch_current_thread()->arch.fpu_recently_used) { in fpu_access_allowed()
267 * Before this thread was context-switched out, in fpu_access_allowed()
279 _current_cpu->arch.fpu_state = MSTATUS_FS_CLEAN; in fpu_access_allowed()
299 esf->mstatus &= ~MSTATUS_FS; in z_riscv_fpu_exit_exc()
300 esf->mstatus |= _current_cpu->arch.fpu_state; in z_riscv_fpu_exit_exc()
302 esf->mstatus &= ~MSTATUS_FS; in z_riscv_fpu_exit_exc()
309 * some exception context then FPU access would be re-evaluated at exception
316 csr_set(mstatus, _current_cpu->arch.fpu_state); in z_riscv_fpu_thread_context_switch()
330 if (thread == _current_cpu->arch.fpu_owner) { in arch_float_disable()