mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-03-24 22:35:16 +00:00
target-mips: use CP0_CHECK for gen_m{f|t}hc0
Reuse CP0_CHECK macro for gen_m{f|t}hc0. Backports commit c98d3d79ee387ea6e8fb091299f8562b20022f10 from qemu
This commit is contained in:
parent
0c5ebbd096
commit
15e0109162
|
@ -4843,14 +4843,19 @@ static inline void gen_mtc0_store32 (DisasContext *ctx, TCGv arg, target_ulong o
|
||||||
tcg_temp_free_i32(tcg_ctx, t0);
|
tcg_temp_free_i32(tcg_ctx, t0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define CP0_CHECK(c) \
|
||||||
|
do { \
|
||||||
|
if (!(c)) { \
|
||||||
|
goto cp0_unimplemented; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
static void gen_mfhc0(DisasContext *ctx, TCGv arg, int reg, int sel)
|
static void gen_mfhc0(DisasContext *ctx, TCGv arg, int reg, int sel)
|
||||||
{
|
{
|
||||||
TCGContext *s = ctx->uc->tcg_ctx;
|
TCGContext *s = ctx->uc->tcg_ctx;
|
||||||
const char *rn = "invalid";
|
const char *rn = "invalid";
|
||||||
|
|
||||||
if (!(ctx->hflags & MIPS_HFLAG_ELPA)) {
|
CP0_CHECK(ctx->hflags & MIPS_HFLAG_ELPA);
|
||||||
goto mfhc0_read_zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (reg) {
|
switch (reg) {
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -4860,7 +4865,7 @@ static void gen_mfhc0(DisasContext *ctx, TCGv arg, int reg, int sel)
|
||||||
rn = "EntryLo0";
|
rn = "EntryLo0";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
goto mfhc0_read_zero;
|
goto cp0_unimplemented;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
@ -4870,7 +4875,7 @@ static void gen_mfhc0(DisasContext *ctx, TCGv arg, int reg, int sel)
|
||||||
rn = "EntryLo1";
|
rn = "EntryLo1";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
goto mfhc0_read_zero;
|
goto cp0_unimplemented;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 17:
|
case 17:
|
||||||
|
@ -4881,7 +4886,7 @@ static void gen_mfhc0(DisasContext *ctx, TCGv arg, int reg, int sel)
|
||||||
rn = "LLAddr";
|
rn = "LLAddr";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
goto mfhc0_read_zero;
|
goto cp0_unimplemented;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 28:
|
case 28:
|
||||||
|
@ -4894,18 +4899,18 @@ static void gen_mfhc0(DisasContext *ctx, TCGv arg, int reg, int sel)
|
||||||
rn = "TagLo";
|
rn = "TagLo";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
goto mfhc0_read_zero;
|
goto cp0_unimplemented;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
goto mfhc0_read_zero;
|
goto cp0_unimplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)rn; /* avoid a compiler warning */
|
(void)rn; /* avoid a compiler warning */
|
||||||
LOG_DISAS("mfhc0 %s (reg %d sel %d)\n", rn, reg, sel);
|
LOG_DISAS("mfhc0 %s (reg %d sel %d)\n", rn, reg, sel);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mfhc0_read_zero:
|
cp0_unimplemented:
|
||||||
LOG_DISAS("mfhc0 %s (reg %d sel %d)\n", rn, reg, sel);
|
LOG_DISAS("mfhc0 %s (reg %d sel %d)\n", rn, reg, sel);
|
||||||
tcg_gen_movi_tl(s, arg, 0);
|
tcg_gen_movi_tl(s, arg, 0);
|
||||||
}
|
}
|
||||||
|
@ -4916,9 +4921,7 @@ static void gen_mthc0(DisasContext *ctx, TCGv arg, int reg, int sel)
|
||||||
const char *rn = "invalid";
|
const char *rn = "invalid";
|
||||||
uint64_t mask = ctx->PAMask >> 36;
|
uint64_t mask = ctx->PAMask >> 36;
|
||||||
|
|
||||||
if (!(ctx->hflags & MIPS_HFLAG_ELPA)) {
|
CP0_CHECK(ctx->hflags & MIPS_HFLAG_ELPA);
|
||||||
goto mthc0_nop;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (reg) {
|
switch (reg) {
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -4929,7 +4932,7 @@ static void gen_mthc0(DisasContext *ctx, TCGv arg, int reg, int sel)
|
||||||
rn = "EntryLo0";
|
rn = "EntryLo0";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
goto mthc0_nop;
|
goto cp0_unimplemented;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
@ -4940,7 +4943,7 @@ static void gen_mthc0(DisasContext *ctx, TCGv arg, int reg, int sel)
|
||||||
rn = "EntryLo1";
|
rn = "EntryLo1";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
goto mthc0_nop;
|
goto cp0_unimplemented;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 17:
|
case 17:
|
||||||
|
@ -4953,7 +4956,7 @@ static void gen_mthc0(DisasContext *ctx, TCGv arg, int reg, int sel)
|
||||||
rn = "LLAddr";
|
rn = "LLAddr";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
goto mthc0_nop;
|
goto cp0_unimplemented;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 28:
|
case 28:
|
||||||
|
@ -4967,15 +4970,15 @@ static void gen_mthc0(DisasContext *ctx, TCGv arg, int reg, int sel)
|
||||||
rn = "TagLo";
|
rn = "TagLo";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
goto mthc0_nop;
|
goto cp0_unimplemented;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
goto mthc0_nop;
|
goto cp0_unimplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)rn; /* avoid a compiler warning */
|
(void)rn; /* avoid a compiler warning */
|
||||||
mthc0_nop:
|
cp0_unimplemented:
|
||||||
LOG_DISAS("mthc0 %s (reg %d sel %d)\n", rn, reg, sel);
|
LOG_DISAS("mthc0 %s (reg %d sel %d)\n", rn, reg, sel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4989,13 +4992,6 @@ static inline void gen_mfc0_unimplemented(DisasContext *ctx, TCGv arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CP0_CHECK(c) \
|
|
||||||
do { \
|
|
||||||
if (!(c)) { \
|
|
||||||
goto cp0_unimplemented; \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel)
|
static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel)
|
||||||
{
|
{
|
||||||
TCGContext *tcg_ctx = ctx->uc->tcg_ctx;
|
TCGContext *tcg_ctx = ctx->uc->tcg_ctx;
|
||||||
|
|
Loading…
Reference in a new issue