CPU and MMU fixes, fixes #1366 and the entire mess that is build 2900.
This commit is contained in:
@@ -39,6 +39,9 @@
|
||||
#define do_mmut_rb(s,a,b) if (readlookup2[(uint32_t)((s)+(a))>>12]==(uintptr_t)LOOKUP_INV || (s)==0xFFFFFFFF) do_mmutranslate((s)+(a), b, 1, 0)
|
||||
#define do_mmut_rw(s,a,b) if (readlookup2[(uint32_t)((s)+(a))>>12]==(uintptr_t)LOOKUP_INV || (s)==0xFFFFFFFF || (((s)+(a)) & 1)) do_mmutranslate((s)+(a), b, 2, 0)
|
||||
#define do_mmut_rl(s,a,b) if (readlookup2[(uint32_t)((s)+(a))>>12]==(uintptr_t)LOOKUP_INV || (s)==0xFFFFFFFF || (((s)+(a)) & 3)) do_mmutranslate((s)+(a), b, 4, 0)
|
||||
#define do_mmut_rb2(s,a,b) old_rl2 = readlookup2[(uint32_t)((s)+(a))>>12]; if (old_rl2==(uintptr_t)LOOKUP_INV || (s)==0xFFFFFFFF) do_mmutranslate((s)+(a), b, 1, 0)
|
||||
#define do_mmut_rw2(s,a,b) old_rl2 = readlookup2[(uint32_t)((s)+(a))>>12]; if (old_rl2==(uintptr_t)LOOKUP_INV || (s)==0xFFFFFFFF || (((s)+(a)) & 1)) do_mmutranslate((s)+(a), b, 2, 0)
|
||||
#define do_mmut_rl2(s,a,b) old_rl2 = readlookup2[(uint32_t)((s)+(a))>>12]; if (old_rl2==(uintptr_t)LOOKUP_INV || (s)==0xFFFFFFFF || (((s)+(a)) & 3)) do_mmutranslate((s)+(a), b, 4, 0)
|
||||
|
||||
#define do_mmut_wb(s,a,b) if (writelookup2[(uint32_t)((s)+(a))>>12]==(uintptr_t)LOOKUP_INV || (s)==0xFFFFFFFF) do_mmutranslate((s)+(a), b, 1, 1)
|
||||
#define do_mmut_ww(s,a,b) if (writelookup2[(uint32_t)((s)+(a))>>12]==(uintptr_t)LOOKUP_INV || (s)==0xFFFFFFFF || (((s)+(a)) & 1)) do_mmutranslate((s)+(a), b, 2, 1)
|
||||
|
||||
@@ -519,14 +519,18 @@ static int opREP_CMPSB_ ## size(uint32_t fetchdat)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg); \
|
||||
SEG_CHECK_READ(&cpu_state.seg_es); \
|
||||
CHECK_READ(cpu_state.ea_seg, SRC_REG, SRC_REG); \
|
||||
high_page = 0; \
|
||||
high_page = uncached = 0; \
|
||||
do_mmut_rb(cpu_state.ea_seg->base, SRC_REG, &addr64); \
|
||||
if (cpu_state.abrt) return 1; \
|
||||
CHECK_READ(&cpu_state.seg_es, DEST_REG, DEST_REG); \
|
||||
do_mmut_rb(es, DEST_REG, &addr64_2); \
|
||||
do_mmut_rb2(es, DEST_REG, &addr64_2); \
|
||||
if (cpu_state.abrt) return 1; \
|
||||
temp = readmemb_n(cpu_state.ea_seg->base, SRC_REG, addr64); if (cpu_state.abrt) return 1; \
|
||||
if (uncached) \
|
||||
readlookup2[(uint32_t)(es+DEST_REG)>>12] = old_rl2; \
|
||||
temp2 = readmemb_n(es, DEST_REG, addr64_2); if (cpu_state.abrt) return 1; \
|
||||
if (uncached) \
|
||||
readlookup2[(uint32_t)(es+DEST_REG)>>12] = (uintptr_t) LOOKUP_INV; \
|
||||
\
|
||||
if (cpu_state.flags & D_FLAG) { DEST_REG--; SRC_REG--; } \
|
||||
else { DEST_REG++; SRC_REG++; } \
|
||||
@@ -559,14 +563,18 @@ static int opREP_CMPSW_ ## size(uint32_t fetchdat)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg); \
|
||||
SEG_CHECK_READ(&cpu_state.seg_es); \
|
||||
CHECK_READ(cpu_state.ea_seg, SRC_REG, SRC_REG + 1UL); \
|
||||
high_page = 0; \
|
||||
high_page = uncached = 0; \
|
||||
do_mmut_rw(cpu_state.ea_seg->base, SRC_REG, addr64a); \
|
||||
if (cpu_state.abrt) return 1; \
|
||||
CHECK_READ(&cpu_state.seg_es, DEST_REG, DEST_REG + 1UL); \
|
||||
do_mmut_rw(es, DEST_REG, addr64a_2); \
|
||||
do_mmut_rw2(es, DEST_REG, addr64a_2); \
|
||||
if (cpu_state.abrt) return 1; \
|
||||
temp = readmemw_n(cpu_state.ea_seg->base, SRC_REG, addr64a); if (cpu_state.abrt) return 1; \
|
||||
if (uncached) \
|
||||
readlookup2[(uint32_t)(es+DEST_REG)>>12] = old_rl2; \
|
||||
temp2 = readmemw_n(es, DEST_REG, addr64a_2); if (cpu_state.abrt) return 1; \
|
||||
if (uncached) \
|
||||
readlookup2[(uint32_t)(es+DEST_REG)>>12] = (uintptr_t) LOOKUP_INV; \
|
||||
\
|
||||
if (cpu_state.flags & D_FLAG) { DEST_REG -= 2; SRC_REG -= 2; } \
|
||||
else { DEST_REG += 2; SRC_REG += 2; } \
|
||||
@@ -599,14 +607,18 @@ static int opREP_CMPSL_ ## size(uint32_t fetchdat)
|
||||
SEG_CHECK_READ(cpu_state.ea_seg); \
|
||||
SEG_CHECK_READ(&cpu_state.seg_es); \
|
||||
CHECK_READ(cpu_state.ea_seg, SRC_REG, SRC_REG + 3UL); \
|
||||
high_page = 0; \
|
||||
high_page = uncached = 0; \
|
||||
do_mmut_rl(cpu_state.ea_seg->base, SRC_REG, addr64a); \
|
||||
if (cpu_state.abrt) return 1; \
|
||||
CHECK_READ(&cpu_state.seg_es, DEST_REG, DEST_REG + 3UL); \
|
||||
do_mmut_rl(es, DEST_REG, addr64a_2); \
|
||||
do_mmut_rl2(es, DEST_REG, addr64a_2); \
|
||||
if (cpu_state.abrt) return 1; \
|
||||
temp = readmeml_n(cpu_state.ea_seg->base, SRC_REG, addr64a); if (cpu_state.abrt) return 1; \
|
||||
if (uncached) \
|
||||
readlookup2[(uint32_t)(es+DEST_REG)>>12] = old_rl2; \
|
||||
temp2 = readmeml_n(es, DEST_REG, addr64a_2); if (cpu_state.abrt) return 1; \
|
||||
if (uncached) \
|
||||
readlookup2[(uint32_t)(es+DEST_REG)>>12] = (uintptr_t) LOOKUP_INV; \
|
||||
\
|
||||
if (cpu_state.flags & D_FLAG) { DEST_REG -= 4; SRC_REG -= 4; } \
|
||||
else { DEST_REG += 4; SRC_REG += 4; } \
|
||||
|
||||
@@ -139,14 +139,18 @@ static int opCMPSB_a16(uint32_t fetchdat)
|
||||
addr64 = addr64_2 = 0x00000000;
|
||||
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
high_page = 0;
|
||||
high_page = uncached = 0;
|
||||
do_mmut_rb(cpu_state.ea_seg->base, SI, &addr64);
|
||||
if (cpu_state.abrt) return 1;
|
||||
SEG_CHECK_READ(&cpu_state.seg_es);
|
||||
do_mmut_rb(es, DI, &addr64_2);
|
||||
do_mmut_rb2(es, DI, &addr64_2);
|
||||
if (cpu_state.abrt) return 1;
|
||||
src = readmemb_n(cpu_state.ea_seg->base, SI, addr64); if (cpu_state.abrt) return 1;
|
||||
if (uncached)
|
||||
readlookup2[(uint32_t)(es+DI)>>12] = old_rl2;
|
||||
dst = readmemb_n(es, DI, addr64_2); if (cpu_state.abrt) return 1;
|
||||
if (uncached)
|
||||
readlookup2[(uint32_t)(es+DI)>>12] = (uintptr_t) LOOKUP_INV;
|
||||
setsub8(src, dst);
|
||||
if (cpu_state.flags & D_FLAG) { DI--; SI--; }
|
||||
else { DI++; SI++; }
|
||||
@@ -161,14 +165,18 @@ static int opCMPSB_a32(uint32_t fetchdat)
|
||||
addr64 = addr64_2 = 0x00000000;
|
||||
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
high_page = 0;
|
||||
high_page = uncached = 0;
|
||||
do_mmut_rb(cpu_state.ea_seg->base, ESI, &addr64);
|
||||
if (cpu_state.abrt) return 1;
|
||||
SEG_CHECK_READ(&cpu_state.seg_es);
|
||||
do_mmut_rb(es, EDI, &addr64_2);
|
||||
do_mmut_rb2(es, EDI, &addr64_2);
|
||||
if (cpu_state.abrt) return 1;
|
||||
src = readmemb_n(cpu_state.ea_seg->base, ESI, addr64); if (cpu_state.abrt) return 1;
|
||||
if (uncached)
|
||||
readlookup2[(uint32_t)(es+EDI)>>12] = old_rl2;
|
||||
dst = readmemb_n(es, EDI, addr64_2); if (cpu_state.abrt) return 1;
|
||||
if (uncached)
|
||||
readlookup2[(uint32_t)(es+EDI)>>12] = (uintptr_t) LOOKUP_INV;
|
||||
setsub8(src, dst);
|
||||
if (cpu_state.flags & D_FLAG) { EDI--; ESI--; }
|
||||
else { EDI++; ESI++; }
|
||||
@@ -185,14 +193,18 @@ static int opCMPSW_a16(uint32_t fetchdat)
|
||||
addr64a_2[0] = addr64a_2[1] = 0x00000000;
|
||||
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
high_page = 0;
|
||||
high_page = uncached = 0;
|
||||
do_mmut_rw(cpu_state.ea_seg->base, SI, addr64a);
|
||||
if (cpu_state.abrt) return 1;
|
||||
SEG_CHECK_READ(&cpu_state.seg_es);
|
||||
do_mmut_rw(es, DI, addr64a_2);
|
||||
do_mmut_rw2(es, DI, addr64a_2);
|
||||
if (cpu_state.abrt) return 1;
|
||||
src = readmemw_n(cpu_state.ea_seg->base, SI, addr64a); if (cpu_state.abrt) return 1;
|
||||
if (uncached)
|
||||
readlookup2[(uint32_t)(es+DI)>>12] = old_rl2;
|
||||
dst = readmemw_n(es, DI, addr64a_2); if (cpu_state.abrt) return 1;
|
||||
if (uncached)
|
||||
readlookup2[(uint32_t)(es+DI)>>12] = (uintptr_t) LOOKUP_INV;
|
||||
setsub16(src, dst);
|
||||
if (cpu_state.flags & D_FLAG) { DI -= 2; SI -= 2; }
|
||||
else { DI += 2; SI += 2; }
|
||||
@@ -208,14 +220,18 @@ static int opCMPSW_a32(uint32_t fetchdat)
|
||||
addr64a_2[0] = addr64a_2[1] = 0x00000000;
|
||||
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
high_page = 0;
|
||||
high_page = uncached = 0;
|
||||
do_mmut_rw(cpu_state.ea_seg->base, ESI, addr64a);
|
||||
if (cpu_state.abrt) return 1;
|
||||
SEG_CHECK_READ(&cpu_state.seg_es);
|
||||
do_mmut_rw(es, EDI, addr64a_2);
|
||||
do_mmut_rw2(es, EDI, addr64a_2);
|
||||
if (cpu_state.abrt) return 1;
|
||||
src = readmemw_n(cpu_state.ea_seg->base, ESI, addr64a); if (cpu_state.abrt) return 1;
|
||||
if (uncached)
|
||||
readlookup2[(uint32_t)(es+EDI)>>12] = old_rl2;
|
||||
dst = readmemw_n(es, EDI, addr64a_2); if (cpu_state.abrt) return 1;
|
||||
if (uncached)
|
||||
readlookup2[(uint32_t)(es+EDI)>>12] = (uintptr_t) LOOKUP_INV;
|
||||
setsub16(src, dst);
|
||||
if (cpu_state.flags & D_FLAG) { EDI -= 2; ESI -= 2; }
|
||||
else { EDI += 2; ESI += 2; }
|
||||
@@ -232,14 +248,18 @@ static int opCMPSL_a16(uint32_t fetchdat)
|
||||
addr64a_2[0] = addr64a_2[1] = addr64a_2[2] = addr64a_2[3] = 0x00000000;
|
||||
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
high_page = 0;
|
||||
high_page = uncached = 0;
|
||||
do_mmut_rl(cpu_state.ea_seg->base, SI, addr64a);
|
||||
if (cpu_state.abrt) return 1;
|
||||
SEG_CHECK_READ(&cpu_state.seg_es);
|
||||
do_mmut_rl(es, DI, addr64a_2);
|
||||
do_mmut_rl2(es, DI, addr64a_2);
|
||||
if (cpu_state.abrt) return 1;
|
||||
src = readmeml_n(cpu_state.ea_seg->base, SI, addr64a); if (cpu_state.abrt) return 1;
|
||||
if (uncached)
|
||||
readlookup2[(uint32_t)(es+DI)>>12] = old_rl2;
|
||||
dst = readmeml_n(es, DI, addr64a_2); if (cpu_state.abrt) return 1;
|
||||
if (uncached)
|
||||
readlookup2[(uint32_t)(es+DI)>>12] = (uintptr_t) LOOKUP_INV;
|
||||
setsub32(src, dst);
|
||||
if (cpu_state.flags & D_FLAG) { DI -= 4; SI -= 4; }
|
||||
else { DI += 4; SI += 4; }
|
||||
@@ -255,14 +275,18 @@ static int opCMPSL_a32(uint32_t fetchdat)
|
||||
addr64a_2[0] = addr64a_2[1] = addr64a_2[2] = addr64a_2[3] = 0x00000000;
|
||||
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
high_page = 0;
|
||||
high_page = uncached = 0;
|
||||
do_mmut_rl(cpu_state.ea_seg->base, ESI, addr64a);
|
||||
if (cpu_state.abrt) return 1;
|
||||
SEG_CHECK_READ(&cpu_state.seg_es);
|
||||
do_mmut_rl(es, EDI, addr64a_2);
|
||||
do_mmut_rl2(es, EDI, addr64a_2);
|
||||
if (cpu_state.abrt) return 1;
|
||||
src = readmeml_n(cpu_state.ea_seg->base, ESI, addr64a); if (cpu_state.abrt) return 1;
|
||||
if (uncached)
|
||||
readlookup2[(uint32_t)(es+EDI)>>12] = old_rl2;
|
||||
dst = readmeml_n(es, EDI, addr64a_2); if (cpu_state.abrt) return 1;
|
||||
if (uncached)
|
||||
readlookup2[(uint32_t)(es+EDI)>>12] = (uintptr_t) LOOKUP_INV;
|
||||
setsub32(src, dst);
|
||||
if (cpu_state.flags & D_FLAG) { EDI -= 4; ESI -= 4; }
|
||||
else { EDI += 4; ESI += 4; }
|
||||
|
||||
Reference in New Issue
Block a user