move saving SH2 SR into memory access and do so only if needed

This commit is contained in:
kub 2019-03-27 21:58:32 +01:00
parent 9031406131
commit ff0eaa11d9
4 changed files with 84 additions and 27 deletions

View file

@ -13,7 +13,7 @@ void sh2_drc_frame(void);
#define sh2_drc_frame()
#endif
#define BLOCK_INSN_LIMIT 128
#define BLOCK_INSN_LIMIT 1024
/* op_flags */
#define OF_DELAY_OP (1 << 0)
@ -25,3 +25,29 @@ void sh2_drc_frame(void);
void scan_block(unsigned int base_pc, int is_slave,
unsigned char *op_flags, unsigned int *end_pc,
unsigned int *end_literals);
#if defined(DRC_SH2)
// direct access to some host CPU registers used by the DRC
// XXX MUST match definitions in cpu/sh2/compiler.c
#if defined(_arm__)
#define DRC_SR_REG r10
#elif defined(__i386__)
#define DRC_SR_REG edi
#else
#warning "direct DRC register access not available for this host"
#endif
#ifdef DCR_SR_REG
#define DRC_DECLARE_SR register int sh2_sr asm(#DCR_SR_REG)
#define DRC_SAVE_SR(sh2) \
if ((sh2->state & (SH2_STATE_RUN|SH2_STATE_BUSY)) == SH2_STATE_RUN) \
sh2->sr = sh2_sr;
#define DRC_RESTORE_SR(sh2) \
if ((sh2->state & (SH2_STATE_RUN|SH2_STATE_BUSY)) == SH2_STATE_RUN) \
sh2_sr = sh2->sr;
#else
#define DRC_DECLARE_SR
#define DRC_SAVE_SR(sh2)
#define DRC_RESTORE_SR(sh2)
#endif
#endif