+#define host_instructions_updated(base, end)
+
+#define host_arg2reg(rd, arg) \
+ switch (arg) { \
+ case 0: rd = xAX; break; \
+ case 1: rd = xDX; break; \
+ case 2: rd = xCX; break; \
+ }
+
+/* SH2 drc specific */
+#define emith_sh2_drc_entry() { \
+ emith_push(xBX); \
+ emith_push(xBP); \
+ emith_push(xSI); \
+ emith_push(xDI); \
+}
+
+#define emith_sh2_drc_exit() { \
+ emith_pop(xDI); \
+ emith_pop(xSI); \
+ emith_pop(xBP); \
+ emith_pop(xBX); \
+ emith_ret(); \
+}
+
+// assumes EBX is free temporary
+#define emith_sh2_wcall(a, tab, ret_ptr) { \
+ int arg2_; \
+ host_arg2reg(arg2_, 2); \
+ emith_lsr(xBX, a, SH2_WRITE_SHIFT); \
+ EMIT_OP_MODRM(0x8b, 0, xBX, 4); \
+ EMIT_SIB(2, xBX, tab); /* mov ebx, [tab + ebx * 4] */ \
+ emith_ctx_read(arg2_, offsetof(SH2, is_slave)); \
+ emith_push_imm((long)(ret_ptr)); \
+ emith_jump_reg(xBX); \
+}
+
+#define emith_sh2_dtbf_loop() { \
+ u8 *jmp0; /* negative cycles check */ \
+ u8 *jmp1; /* unsinged overflow check */ \
+ int cr, rn; \
+ int tmp_ = rcache_get_tmp(); \
+ cr = rcache_get_reg(SHR_SR, RC_GR_RMW); \
+ rn = rcache_get_reg((op >> 8) & 0x0f, RC_GR_RMW);\
+ emith_sub_r_imm(rn, 1); \
+ emith_sub_r_imm(cr, (cycles+1) << 12); \
+ cycles = 0; \
+ emith_asr(tmp_, cr, 2+12); \
+ JMP8_POS(jmp0); /* no negative cycles */ \
+ emith_move_r_imm(tmp_, 0); \
+ JMP8_EMIT(ICOND_JNS, jmp0); \
+ emith_and_r_imm(cr, 0xffe); \
+ emith_subf_r_r(rn, tmp_); \
+ JMP8_POS(jmp1); /* no overflow */ \
+ emith_neg_r(rn); /* count left */ \
+ emith_lsl(rn, rn, 2+12); \
+ emith_or_r_r(cr, rn); \
+ emith_or_r_imm(cr, 1); \
+ emith_move_r_imm(rn, 0); \
+ JMP8_EMIT(ICOND_JA, jmp1); \
+ rcache_free_tmp(tmp_); \
+}
+
+#define emith_write_sr(sr, srcr) { \
+ int tmp_ = rcache_get_tmp(); \
+ emith_clear_msb(tmp_, srcr, 22); \
+ emith_bic_r_imm(sr, 0x3ff); \
+ emith_or_r_r(sr, tmp_); \
+ rcache_free_tmp(tmp_); \
+}
+
+#define emith_tpop_carry(sr, is_sub) \
+ emith_lsr(sr, sr, 1)
+
+#define emith_tpush_carry(sr, is_sub) \
+ emith_adc_r_r(sr, sr)
+
+/*
+ * if Q
+ * t = carry(Rn += Rm)
+ * else
+ * t = carry(Rn -= Rm)
+ * T ^= t
+ */
+#define emith_sh2_div1_step(rn, rm, sr) { \
+ u8 *jmp0, *jmp1; \
+ int tmp_ = rcache_get_tmp(); \
+ emith_eor_r_r(tmp_, tmp_); \
+ emith_tst_r_imm(sr, Q); /* if (Q ^ M) */ \
+ JMP8_POS(jmp0); /* je do_sub */ \
+ emith_add_r_r(rn, rm); \
+ JMP8_POS(jmp1); /* jmp done */ \
+ JMP8_EMIT(ICOND_JE, jmp0); /* do_sub: */ \
+ emith_sub_r_r(rn, rm); \
+ JMP8_EMIT_NC(jmp1); /* done: */ \
+ emith_setc(tmp_); \
+ EMIT_OP_MODRM(0x31, 3, tmp_, sr); /* T = Q1 ^ Q2 */ \
+ rcache_free_tmp(tmp_); \
+}
+