/* * Determine the IEEE 754 NaN encodings and ABS.fmt/NEG.fmt execution modes * supported by FPU hardware.
*/ staticvoid cpu_set_fpu_2008(struct cpuinfo_mips *c)
{ if (c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M64R1 |
MIPS_CPU_ISA_M32R2 | MIPS_CPU_ISA_M64R2 |
MIPS_CPU_ISA_M32R5 | MIPS_CPU_ISA_M64R5 |
MIPS_CPU_ISA_M32R6 | MIPS_CPU_ISA_M64R6)) { unsignedlong sr, fir, fcsr, fcsr0, fcsr1;
sr = read_c0_status();
__enable_fpu(FPU_AS_IS);
fir = read_32bit_cp1_register(CP1_REVISION); if (fir & MIPS_FPIR_HAS2008) {
fcsr = read_32bit_cp1_register(CP1_STATUS);
/* * MAC2008 toolchain never landed in real world, so * we're only testing whether it can be disabled and * don't try to enabled it.
*/
fcsr0 = fcsr & ~(FPU_CSR_ABS2008 | FPU_CSR_NAN2008 |
FPU_CSR_MAC2008);
write_32bit_cp1_register(CP1_STATUS, fcsr0);
fcsr0 = read_32bit_cp1_register(CP1_STATUS);
if (c->isa_level & (MIPS_CPU_ISA_M32R2 |
MIPS_CPU_ISA_M64R2)) { /* * The bit for MAC2008 might be reused by R6 * in future, so we only test for R2-R5.
*/ if (fcsr0 & FPU_CSR_MAC2008)
c->options |= MIPS_CPU_MAC_2008_ONLY;
}
if (!(fcsr0 & FPU_CSR_NAN2008))
c->options |= MIPS_CPU_NAN_LEGACY; if (fcsr1 & FPU_CSR_NAN2008)
c->options |= MIPS_CPU_NAN_2008;
/* * IEEE 754 conformance mode to use. Affects the NaN encoding and the * ABS.fmt/NEG.fmt execution mode.
*/ staticenum { STRICT, EMULATED, LEGACY, STD2008, RELAXED } ieee754 = STRICT;
/* * Set the IEEE 754 NaN encodings and the ABS.fmt/NEG.fmt execution modes * to support by the FPU emulator according to the IEEE 754 conformance * mode selected. Note that "relaxed" straps the emulator so that it * allows 2008-NaN binaries even for legacy processors.
*/ staticvoid cpu_set_nofpu_2008(struct cpuinfo_mips *c)
{
c->options &= ~(MIPS_CPU_NAN_2008 | MIPS_CPU_NAN_LEGACY);
c->fpu_csr31 &= ~(FPU_CSR_ABS2008 | FPU_CSR_NAN2008);
c->fpu_msk31 &= ~(FPU_CSR_ABS2008 | FPU_CSR_NAN2008);
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.