/* * This enum specifies a mode in which we want the FPU to operate, for cores * which implement the Status.FR bit. Note that the bottom bit of the value * purposefully matches the desired value of the Status.FR bit.
*/ enum fpu_mode {
FPU_32BIT = 0, /* FR = 0 */
FPU_64BIT, /* FR = 1, FRE = 0 */
FPU_AS_IS,
FPU_HYBRID, /* FR = 1, FRE = 1 */
/** * init_fp_ctx() - Initialize task FP context * @target: The task whose FP context should be initialized. * * Initializes the FP context of the target task to sane default values if that * target task does not already have valid FP context. Once the context has * been initialized, the task will be marked as having used FP & thus having * valid FP context. * * Returns: true if context is initialized, else false.
*/ staticinlinebool init_fp_ctx(struct task_struct *target)
{ /* If FP has been used then the target already has context */ if (tsk_used_math(target)) returnfalse;
/* Begin with data registers set to all 1s... */
memset(&target->thread.fpu.fpr, ~0, sizeof(target->thread.fpu.fpr));
/* FCSR has been preset by `mips_set_personality_nan'. */
/* * Record that the target has "used" math, such that the context * just initialised, and any modifications made by the caller, * aren't discarded.
*/
set_stopped_child_used_math(target);
returntrue;
}
staticinlinevoid save_fp(struct task_struct *tsk)
{ if (cpu_has_fpu)
_save_fp(tsk);
}
staticinlinevoid restore_fp(struct task_struct *tsk)
{ if (cpu_has_fpu)
_restore_fp(tsk);
}
staticinlineunion fpureg *get_fpu_regs(struct task_struct *tsk)
{ if (tsk == current) {
preempt_disable(); if (is_fpu_owner())
_save_fp(current);
preempt_enable();
}
return tsk->thread.fpu.fpr;
}
#else/* !CONFIG_MIPS_FP_SUPPORT */
/* * When FP support is disabled we provide only a minimal set of stub functions * to avoid callers needing to care too much about CONFIG_MIPS_FP_SUPPORT.
*/
/* * The following functions should only be called in paths where we know that FP * support is enabled, typically a path where own_fpu() or __enable_fpu() have * returned successfully. When CONFIG_MIPS_FP_SUPPORT=n it is known at compile * time that this should never happen, so calls to these functions should be * optimized away & never actually be emitted.
*/
externvoid save_fp(struct task_struct *tsk)
__compiletime_error("save_fp() should not be called when CONFIG_MIPS_FP_SUPPORT=n");
externvoid _save_fp(struct task_struct *)
__compiletime_error("_save_fp() should not be called when CONFIG_MIPS_FP_SUPPORT=n");
externvoid restore_fp(struct task_struct *tsk)
__compiletime_error("restore_fp() should not be called when CONFIG_MIPS_FP_SUPPORT=n");
externvoid _restore_fp(struct task_struct *)
__compiletime_error("_restore_fp() should not be called when CONFIG_MIPS_FP_SUPPORT=n");
externunion fpureg *get_fpu_regs(struct task_struct *tsk)
__compiletime_error("get_fpu_regs() should not be called when CONFIG_MIPS_FP_SUPPORT=n");
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.