mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-11 06:35:30 +00:00
target/mips: Fix RDHWR CC with icount
RDHWR CC reads the CPU timer like MFC0 CP0_Count, so with icount enabled it must set can_do_io while it calls the helper to avoid the "Bad icount read" error. It should also break out of the translation loop to ensure that timer interrupts are immediately handled. Backports commit d673a68db6963e86536b125af464bb6ed03eba33 from qemu
This commit is contained in:
parent
cb20fdce64
commit
4cc63bac09
|
@ -10867,8 +10867,24 @@ static void gen_rdhwr(DisasContext *ctx, int rt, int rd, int sel)
|
|||
gen_store_gpr(tcg_ctx, t0, rt);
|
||||
break;
|
||||
case 2:
|
||||
// Unicorn: if'd out
|
||||
#if 0
|
||||
if (ctx->tb->cflags & CF_USE_ICOUNT) {
|
||||
gen_io_start();
|
||||
}
|
||||
#endif
|
||||
gen_helper_rdhwr_cc(tcg_ctx, t0, tcg_ctx->cpu_env);
|
||||
#if 0
|
||||
if (ctx->tb->cflags & CF_USE_ICOUNT) {
|
||||
gen_io_end();
|
||||
}
|
||||
#endif
|
||||
gen_store_gpr(tcg_ctx, t0, rt);
|
||||
/* Break the TB to be able to take timer interrupts immediately
|
||||
after reading count. BS_STOP isn't sufficient, we need to ensure
|
||||
we break completely out of translated code. */
|
||||
gen_save_pc(ctx, ctx->pc + 4);
|
||||
ctx->bstate = BS_EXCP;
|
||||
break;
|
||||
case 3:
|
||||
gen_helper_rdhwr_ccres(tcg_ctx, t0, tcg_ctx->cpu_env);
|
||||
|
|
Loading…
Reference in a new issue