target/mips: Clean up handling of CP0 register 8

Clean up handling of CP0 register 8.

Backports commit 67d167d2d83d059932c99c077b402b94339c8cf0 from qemu
This commit is contained in:
Aleksandar Markovic 2019-11-18 22:59:30 -05:00 committed by Lioncash
parent 38f0e31950
commit f4015517ab
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
2 changed files with 17 additions and 12 deletions

View file

@ -332,6 +332,7 @@ typedef struct mips_def_t mips_def_t;
#define CP0_REG08__BADVADDR 0
#define CP0_REG08__BADINSTR 1
#define CP0_REG08__BADINSTRP 2
#define CP0_REG08__BADINSTRX 3
/* CP0 Register 09 */
#define CP0_REG09__COUNT 0
#define CP0_REG09__SAARI 6

View file

@ -7179,17 +7179,17 @@ static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel)
break;
case CP0_REGISTER_08:
switch (sel) {
case 0:
case CP0_REG08__BADVADDR:
tcg_gen_ld_tl(tcg_ctx, arg, tcg_ctx->cpu_env, offsetof(CPUMIPSState, CP0_BadVAddr));
tcg_gen_ext32s_tl(tcg_ctx, arg, arg);
register_name = "BadVAddr";
break;
case 1:
case CP0_REG08__BADINSTR:
CP0_CHECK(ctx->bi);
gen_mfc0_load32(ctx, arg, offsetof(CPUMIPSState, CP0_BadInstr));
register_name = "BadInstr";
break;
case 2:
case CP0_REG08__BADINSTRP:
CP0_CHECK(ctx->bp);
gen_mfc0_load32(ctx, arg, offsetof(CPUMIPSState, CP0_BadInstrP));
register_name = "BadInstrP";
@ -7910,18 +7910,22 @@ static void gen_mtc0(DisasContext *ctx, TCGv arg, int reg, int sel)
break;
case CP0_REGISTER_08:
switch (sel) {
case 0:
case CP0_REG08__BADVADDR:
/* ignored */
register_name = "BadVAddr";
break;
case 1:
case CP0_REG08__BADINSTR:
/* ignored */
register_name = "BadInstr";
break;
case 2:
case CP0_REG08__BADINSTRP:
/* ignored */
register_name = "BadInstrP";
break;
case CP0_REG08__BADINSTRX:
/* ignored */
register_name = "BadInstrX";
break;
default:
goto cp0_unimplemented;
}
@ -8649,16 +8653,16 @@ static void gen_dmfc0(DisasContext *ctx, TCGv arg, int reg, int sel)
break;
case CP0_REGISTER_08:
switch (sel) {
case 0:
case CP0_REG08__BADVADDR:
tcg_gen_ld_tl(tcg_ctx, arg, tcg_ctx->cpu_env, offsetof(CPUMIPSState, CP0_BadVAddr));
register_name = "BadVAddr";
break;
case 1:
case CP0_REG08__BADINSTR:
CP0_CHECK(ctx->bi);
gen_mfc0_load32(ctx, arg, offsetof(CPUMIPSState, CP0_BadInstr));
register_name = "BadInstr";
break;
case 2:
case CP0_REG08__BADINSTRP:
CP0_CHECK(ctx->bp);
gen_mfc0_load32(ctx, arg, offsetof(CPUMIPSState, CP0_BadInstrP));
register_name = "BadInstrP";
@ -9362,15 +9366,15 @@ static void gen_dmtc0(DisasContext *ctx, TCGv arg, int reg, int sel)
break;
case CP0_REGISTER_08:
switch (sel) {
case 0:
case CP0_REG08__BADVADDR:
/* ignored */
register_name = "BadVAddr";
break;
case 1:
case CP0_REG08__BADINSTR:
/* ignored */
register_name = "BadInstr";
break;
case 2:
case CP0_REG08__BADINSTRP:
/* ignored */
register_name = "BadInstrP";
break;