The Config3.ISA == 3 test ANDs bit 14 and bit 15 as two separate
constants, so it is always false and no CPU resets into microMIPS
mode.  Test the 2-bit field instead.

Config3.ISA == 3: both MIPS32 and microMIPS32 are implemented, with
microMIPS32 used out of reset (MD00090 rev 6.02, Table 9.67, p. 248).

Fixes: 0bbc0396809f ("target/mips: Prevent switching mode Config3 ISA bit 
nanoMIPS")
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
 target/mips/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/mips/cpu.c b/target/mips/cpu.c
index 8ad5e49ade41..324e5989cca1 100644
--- a/target/mips/cpu.c
+++ b/target/mips/cpu.c
@@ -459,7 +459,7 @@ static void mips_cpu_reset_hold(Object *obj, ResetType type)
         env->CP0_PWField = 0x02;
     }
 
-    if (env->CP0_Config3 & (1 << CP0C3_ISA) & (1 << (CP0C3_ISA + 1))) {
+    if (extract32(env->CP0_Config3, CP0C3_ISA, 2) == 3) {
         /*  microMIPS on reset when Config3.ISA is 3 */
         env->hflags |= MIPS_HFLAG_M16;
     }
-- 
2.55.0


Reply via email to