Commit 64cf6d120d for qemu.org
commit 64cf6d120d0a27b0e25eafb46a83d38eca2f173c
Author: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Date: Wed Oct 28 20:25:29 2026 +0100
target/mips: Re-introduce the R5900 CPU in system mode
Partly revert commit 823f2897bdd7 ("target/mips: Disable R5900
support"), which disabled it over ABI and emulation accuracy
concerns. Those ABI concerns only affect user mode, so keep the
CPU unavailable there. In system mode we now have enough of the
CPU (MMI instructions and bare-metal tests) to use it.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20261028192538.31600-2-philmd@oss.qualcomm.com>
diff --git a/target/mips/cpu-defs.c.inc b/target/mips/cpu-defs.c.inc
index b2ddfa1e82..5f6fa2900f 100644
--- a/target/mips/cpu-defs.c.inc
+++ b/target/mips/cpu-defs.c.inc
@@ -590,6 +590,51 @@ const mips_def_t mips_defs[] =
.insn_flags = CPU_MIPS4 | INSN_VR54XX,
.mmu_type = MMU_TYPE_R4000,
},
+#ifndef CONFIG_USER_ONLY
+ {
+ /*
+ * The Toshiba TX System RISC TX79 Core Architecture manual
+ *
+ * https://wiki.qemu.org/File:C790.pdf
+ *
+ * describes the C790 processor that is a follow-up to the R5900.
+ * There are a few notable differences in that the R5900 FPU
+ *
+ * - is not IEEE 754-1985 compliant,
+ * - does not implement double format, and
+ * - its machine code is nonstandard.
+ */
+ .name = "R5900",
+ .CP0_PRid = 0x00002E00,
+ /* No L2 cache, icache size 32k, dcache size 32k, uncached coherency. */
+ .CP0_Config0 = (0x3 << 9) | (0x3 << 6) | (0x2 << CP0C0_K0),
+ .CP0_Status_rw_bitmask = 0xF4C79C1F,
+ /*
+ * The R5900 COP1 FPU implements single-precision floating-point
+ * operations but is not entirely IEEE 754-1985 compatible. In
+ * particular,
+ *
+ * - NaN (not a number) and +/- infinities are not supported;
+ * - exception mechanisms are not fully supported;
+ * - denormalized numbers are not supported;
+ * - rounding towards nearest and +/- infinities are not supported;
+ * - computed results usually differs in the least significant bit;
+ * - saturations can differ more than the least significant bit.
+ *
+ * Since only rounding towards zero is supported, the two least
+ * significant bits of FCR31 are hardwired to 01.
+ *
+ * FPU emulation is disabled here until it is implemented.
+ *
+ * Note: Config1 is only used internally, the R5900 has only Config0.
+ */
+ .CP0_Config1 = (47 << CP0C1_MMU),
+ .SEGBITS = 32,
+ .PABITS = 32,
+ .insn_flags = CPU_MIPS3 | INSN_R5900 | ASE_MMI,
+ .mmu_type = MMU_TYPE_R4000,
+ },
+#endif /* !CONFIG_USER_ONLY */
{
.name = "5Kc",
.CP0_PRid = 0x00018100,