diff --git a/qemu/target/mips/translate.c b/qemu/target/mips/translate.c index f3437b57..e2c6681b 100644 --- a/qemu/target/mips/translate.c +++ b/qemu/target/mips/translate.c @@ -4971,12 +4971,11 @@ static void gen_mfhc0(DisasContext *ctx, TCGv arg, int reg, int sel) TCGContext *s = ctx->uc->tcg_ctx; const char *rn = "invalid"; - CP0_CHECK(ctx->hflags & MIPS_HFLAG_ELPA); - switch (reg) { case 2: switch (sel) { case 0: + CP0_CHECK(ctx->hflags & MIPS_HFLAG_ELPA); gen_mfhc0_entrylo(s, arg, offsetof(CPUMIPSState, CP0_EntryLo0)); rn = "EntryLo0"; break; @@ -4987,6 +4986,7 @@ static void gen_mfhc0(DisasContext *ctx, TCGv arg, int reg, int sel) case 3: switch (sel) { case 0: + CP0_CHECK(ctx->hflags & MIPS_HFLAG_ELPA); gen_mfhc0_entrylo(s, arg, offsetof(CPUMIPSState, CP0_EntryLo1)); rn = "EntryLo1"; break; @@ -5042,12 +5042,11 @@ static void gen_mthc0(DisasContext *ctx, TCGv arg, int reg, int sel) const char *rn = "invalid"; uint64_t mask = ctx->PAMask >> 36; - CP0_CHECK(ctx->hflags & MIPS_HFLAG_ELPA); - switch (reg) { case 2: switch (sel) { case 0: + CP0_CHECK(ctx->hflags & MIPS_HFLAG_ELPA); tcg_gen_andi_tl(s, arg, arg, mask); gen_mthc0_entrylo(s, arg, offsetof(CPUMIPSState, CP0_EntryLo0)); rn = "EntryLo0"; @@ -5059,6 +5058,7 @@ static void gen_mthc0(DisasContext *ctx, TCGv arg, int reg, int sel) case 3: switch (sel) { case 0: + CP0_CHECK(ctx->hflags & MIPS_HFLAG_ELPA); tcg_gen_andi_tl(s, arg, arg, mask); gen_mthc0_entrylo(s, arg, offsetof(CPUMIPSState, CP0_EntryLo1)); rn = "EntryLo1";