EMITH_HINT_COND(DCOND_EQ);
emith_subf_r_r_imm(tmp, tmp2, 1);
emith_set_t_cond(sr, DCOND_EQ);
+ emith_or_r_imm(sr, SH2_NO_POLLING);
goto end_op;
}
goto default_;
sh2->sr |= T;\r
else\r
sh2->sr &= ~T;\r
+ sh2->no_polling = SH2_NO_POLLING;\r
#if BUSY_LOOP_HACKS\r
{\r
UINT32 next_opcode = (UINT32)(UINT16)RW( sh2, sh2->ppc & AM );\r
static __inline unsigned int name(SH2 *sh2, unsigned int a) \
{ \
unsigned int ret; \
- sh2->sr |= sh2->icount << 12; \
+ sh2->sr |= (sh2->icount << 12) | (sh2->no_polling); \
ret = cname(a, sh2); \
sh2->icount = (signed int)sh2->sr >> 12; \
+ sh2->no_polling = (sh2->sr & SH2_NO_POLLING); \
sh2->sr &= 0x3f3; \
return ret; \
}
#define MAKE_WRITEFUNC(name, cname) \
static __inline void name(SH2 *sh2, unsigned int a, unsigned int d) \
{ \
- sh2->sr |= sh2->icount << 12; \
+ sh2->sr |= (sh2->icount << 12) | (sh2->no_polling); \
cname(a, d, sh2); \
sh2->icount = (signed int)sh2->sr >> 12; \
+ sh2->no_polling = (sh2->sr & SH2_NO_POLLING); \
sh2->sr &= 0x3f3; \
}
uint32_t poll_addr;\r
int poll_cycles;\r
int poll_cnt;\r
+// NB MUST be a bit unused in SH2 SR, see also cpu/sh2/compiler.c!\r
+#define SH2_NO_POLLING (1 << 10) // poll detection control\r
+ int no_polling;\r
\r
// DRC branch cache. size must be 2^n and <=128\r
int rts_cache_idx;\r
// reading 2 consecutive 16bit values is probably a 32bit access. detect this
// by checking address (max 2 bytes away) and cycles (max 2 cycles later).
// no polling if more than 20 cycles have passed since last detect call.
- if (a - sh2->poll_addr <= 2 && CYCLES_GE(10, cycles_diff)) {
- if (CYCLES_GT(cycles_diff, 2) && ++sh2->poll_cnt >= maxcnt) {
+ if (a - sh2->poll_addr <= 2 && CYCLES_GE(20, cycles_diff)) {
+ if (!sh2_not_polling(sh2) && CYCLES_GT(cycles_diff, 2) &&
+ ++sh2->poll_cnt >= maxcnt) {
if (!(sh2->state & flags))
elprintf_sh2(sh2, EL_32X, "state: %02x->%02x",
sh2->state, sh2->state | flags);
sh2->poll_addr = a;
}
sh2->poll_cycles = cycles_done;
+ sh2_set_polling(sh2);
}
void NOINLINE p32x_sh2_poll_event(SH2 *sh2, u32 flags, u32 m68k_cycles)
# define sh2_cycles_left(sh2) (sh2)->icount\r
# define sh2_burn_cycles(sh2, n) (sh2)->icount -= n\r
# define sh2_pc(sh2) (sh2)->ppc\r
+# define sh2_not_polling(sh2) (sh2)->no_polling\r
+# define sh2_set_polling(sh2) (sh2)->no_polling = 0\r
#else\r
# define sh2_end_run(sh2, after_) do { \\r
int left_ = ((signed int)(sh2)->sr >> 12) - (after_); \\r
# define sh2_cycles_left(sh2) ((signed int)(sh2)->sr >> 12)\r
# define sh2_burn_cycles(sh2, n) (sh2)->sr -= ((n) << 12)\r
# define sh2_pc(sh2) (sh2)->pc\r
+# define sh2_not_polling(sh2) ((sh2)->sr & SH2_NO_POLLING)\r
+# define sh2_set_polling(sh2) ((sh2)->sr &= ~SH2_NO_POLLING)\r
#endif\r
\r
#define sh2_cycles_done(sh2) (unsigned)((int)(sh2)->cycles_timeslice - sh2_cycles_left(sh2))\r