JIT indirect/safe mode MOVEM.W bug fix.

This commit is contained in:
Toni Wilen 2021-12-18 19:45:33 +02:00
parent 71db4693b4
commit 33e2150233
6 changed files with 18 additions and 16 deletions

View File

@ -15,6 +15,7 @@ extern void a1000_reset(void);
#ifdef JIT
extern int special_mem;
extern int special_mem_default;
extern int jit_n_addr_unsafe;
#endif

View File

@ -524,9 +524,6 @@ extern void compile_block(cpu_history* pc_hist, int blocklen, int totcyles);
#define MAXCYCLES (1000 * CYCLE_UNIT)
#define scaled_cycles(x) (currprefs.m68k_speed<0?(((x)/SCALE)?(((x)/SCALE<MAXCYCLES?((x)/SCALE):MAXCYCLES)):1):(x))
/* Flags for Bernie during development/debugging. Should go away eventually */
#define DISTRUST_CONSISTENT_MEM 0
struct op_properties {
uae_u8 use_flags;
uae_u8 set_flags;

View File

@ -9,6 +9,8 @@ bool check_prefs_changed_comp (bool checkonly)
static int cachesize_prev, comptrust_prev;
static bool canbang_prev;
special_mem_default = currprefs.comptrustbyte ? (S_READ | S_WRITE | S_N_ADDR) : 0;
if (currprefs.comptrustbyte != changed_prefs.comptrustbyte ||
currprefs.comptrustword != changed_prefs.comptrustword ||
currprefs.comptrustlong != changed_prefs.comptrustlong ||

View File

@ -64,7 +64,7 @@
#define DISABLE_I_SWAP
#define DISABLE_I_EXG
#define DISABLE_I_EXT
#define DISABLE_I_MVEL
#define DISABLE_I_MVMEL
#define DISABLE_I_MVMLE
#define DISABLE_I_RTD
#define DISABLE_I_LINK
@ -923,6 +923,7 @@ genmovemel(uae_u16 opcode)
break;
case sz_word:
comprintf("\t\t\t\treadword(tmp,i,scratchie);\n"
"\t\t\t\tsign_extend_16_rr(i,i);\n"
"\t\t\t\tadd_l_ri(tmp,2);\n");
break;
default: assert(0);
@ -955,15 +956,18 @@ genmovemle(uae_u16 opcode)
on her, but unfortunately, gfx mem isn't "real" mem, and thus that
act of cleverness means that movmle must pay attention to special_mem,
or Genetic Species is a rather boring-looking game ;-) */
if (table68k[opcode].size == sz_long)
comprintf("\tif (1 && !special_mem && !jit_n_addr_unsafe) {\n");
else
if (table68k[opcode].dmode != Apdi) {
comprintf("\tif (1 && !special_mem && !jit_n_addr_unsafe) {\n");
} else {
// if Apdi and dstreg is included with mask: use indirect mode.
comprintf("\tif (1 && !special_mem && !jit_n_addr_unsafe && !(mask & (1 << (7 - dstreg)))) {\n");
}
#endif
comprintf("\tget_n_addr(srca,native,scratchie);\n");
if (table68k[opcode].dmode != Apdi) {
comprintf("\tfor (i=0;i<16;i++) {\n"
comprintf("\tfor (i=0;i<16 && mask;i++) {\n"
"\t\tif ((mask>>i)&1) {\n");
switch (table68k[opcode].size) {
case sz_long:
@ -981,7 +985,7 @@ genmovemle(uae_u16 opcode)
default: assert(0);
}
} else { /* Pre-decrement */
comprintf("\tfor (i=0;i<16;i++) {\n"
comprintf("\tfor (i=0;i<16 && mask;i++) {\n"
"\t\tif ((mask>>i)&1) {\n");
switch (table68k[opcode].size) {
case sz_long:
@ -1002,7 +1006,6 @@ genmovemle(uae_u16 opcode)
}
}
comprintf("\t\t}\n");
comprintf("\t}\n");
if (table68k[opcode].dmode == Apdi) {
@ -1013,7 +1016,7 @@ genmovemle(uae_u16 opcode)
if (table68k[opcode].dmode != Apdi) {
comprintf("\tmov_l_rr(tmp,srca);\n");
comprintf("\tfor (i=0;i<16;i++) {\n"
comprintf("\tfor (i=0;i<16 && mask;i++) {\n"
"\t\tif ((mask>>i)&1) {\n");
switch (table68k[opcode].size) {
case sz_long:
@ -1027,7 +1030,7 @@ genmovemle(uae_u16 opcode)
default: assert(0);
}
} else { /* Pre-decrement */
comprintf("\tfor (i=0;i<16;i++) {\n"
comprintf("\tfor (i=0;i<16 && mask;i++) {\n"
"\t\tif ((mask>>i)&1) {\n");
switch (table68k[opcode].size) {
case sz_long:
@ -1042,7 +1045,6 @@ genmovemle(uae_u16 opcode)
}
}
comprintf("\t\t}\n");
comprintf("\t}\n");
if (table68k[opcode].dmode == Apdi) {
@ -1841,7 +1843,7 @@ gen_opcode(unsigned int opcode)
break;
case i_MVMEL:
#ifdef DISABLE_I_MVEL
#ifdef DISABLE_I_MVMEL
failure;
#endif
genmovemel(opcode);

View File

@ -47,7 +47,7 @@ bool canbang;
static bool rom_write_enabled;
#ifdef JIT
/* Set by each memory handler that does not simply access real memory. */
int special_mem;
int special_mem, special_mem_default;
/* do not use get_n_addr */
int jit_n_addr_unsafe;
#endif

View File

@ -5269,7 +5269,7 @@ void execute_normal(void)
/* Take note: This is the do-it-normal loop */
r->opcode = get_jit_opcode();
special_mem = DISTRUST_CONSISTENT_MEM;
special_mem = special_mem_default;
pc_hist[blocklen].location = (uae_u16*)r->pc_p;
(*cpufunctbl[r->opcode])(r->opcode);