Perform NULL segment checks upfront in opcode handlers, rather than on every memory access.
This removes the need to pass the segment to readmem*l()/writemem*l().
This commit is contained in:
parent
648aa0e3e8
commit
0f0a1c3223
31 changed files with 976 additions and 325 deletions
|
|
@ -281,6 +281,8 @@ static int opC0_a16(uint32_t fetchdat)
|
|||
uint8_t temp, temp2;
|
||||
|
||||
fetch_ea_16(fetchdat);
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
c = readmemb(cs, cpu_state.pc) & 31; cpu_state.pc++;
|
||||
PREFETCH_PREFIX();
|
||||
temp = geteab(); if (cpu_state.abrt) return 1;
|
||||
|
|
@ -294,6 +296,8 @@ static int opC0_a32(uint32_t fetchdat)
|
|||
uint8_t temp, temp2;
|
||||
|
||||
fetch_ea_32(fetchdat);
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
c = readmemb(cs, cpu_state.pc) & 31; cpu_state.pc++;
|
||||
PREFETCH_PREFIX();
|
||||
temp = geteab(); if (cpu_state.abrt) return 1;
|
||||
|
|
@ -307,6 +311,8 @@ static int opC1_w_a16(uint32_t fetchdat)
|
|||
uint16_t temp, temp2;
|
||||
|
||||
fetch_ea_16(fetchdat);
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
c = readmemb(cs, cpu_state.pc) & 31; cpu_state.pc++;
|
||||
PREFETCH_PREFIX();
|
||||
temp = geteaw(); if (cpu_state.abrt) return 1;
|
||||
|
|
@ -320,6 +326,8 @@ static int opC1_w_a32(uint32_t fetchdat)
|
|||
uint16_t temp, temp2;
|
||||
|
||||
fetch_ea_32(fetchdat);
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
c = readmemb(cs, cpu_state.pc) & 31; cpu_state.pc++;
|
||||
PREFETCH_PREFIX();
|
||||
temp = geteaw(); if (cpu_state.abrt) return 1;
|
||||
|
|
@ -333,6 +341,8 @@ static int opC1_l_a16(uint32_t fetchdat)
|
|||
uint32_t temp, temp2;
|
||||
|
||||
fetch_ea_16(fetchdat);
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
c = readmemb(cs, cpu_state.pc) & 31; cpu_state.pc++;
|
||||
PREFETCH_PREFIX();
|
||||
temp = geteal(); if (cpu_state.abrt) return 1;
|
||||
|
|
@ -346,6 +356,8 @@ static int opC1_l_a32(uint32_t fetchdat)
|
|||
uint32_t temp, temp2;
|
||||
|
||||
fetch_ea_32(fetchdat);
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
c = readmemb(cs, cpu_state.pc) & 31; cpu_state.pc++;
|
||||
PREFETCH_PREFIX();
|
||||
temp = geteal(); if (cpu_state.abrt) return 1;
|
||||
|
|
@ -360,6 +372,8 @@ static int opD0_a16(uint32_t fetchdat)
|
|||
uint8_t temp, temp2;
|
||||
|
||||
fetch_ea_16(fetchdat);
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
temp = geteab(); if (cpu_state.abrt) return 1;
|
||||
OP_SHIFT_b(c, 0);
|
||||
return 0;
|
||||
|
|
@ -371,6 +385,8 @@ static int opD0_a32(uint32_t fetchdat)
|
|||
uint8_t temp, temp2;
|
||||
|
||||
fetch_ea_32(fetchdat);
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
temp = geteab(); if (cpu_state.abrt) return 1;
|
||||
OP_SHIFT_b(c, 1);
|
||||
return 0;
|
||||
|
|
@ -382,6 +398,8 @@ static int opD1_w_a16(uint32_t fetchdat)
|
|||
uint16_t temp, temp2;
|
||||
|
||||
fetch_ea_16(fetchdat);
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
temp = geteaw(); if (cpu_state.abrt) return 1;
|
||||
OP_SHIFT_w(c, 0);
|
||||
return 0;
|
||||
|
|
@ -393,6 +411,8 @@ static int opD1_w_a32(uint32_t fetchdat)
|
|||
uint16_t temp, temp2;
|
||||
|
||||
fetch_ea_32(fetchdat);
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
temp = geteaw(); if (cpu_state.abrt) return 1;
|
||||
OP_SHIFT_w(c, 1);
|
||||
return 0;
|
||||
|
|
@ -404,6 +424,8 @@ static int opD1_l_a16(uint32_t fetchdat)
|
|||
uint32_t temp, temp2;
|
||||
|
||||
fetch_ea_16(fetchdat);
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
temp = geteal(); if (cpu_state.abrt) return 1;
|
||||
OP_SHIFT_l(c, 0);
|
||||
return 0;
|
||||
|
|
@ -415,6 +437,8 @@ static int opD1_l_a32(uint32_t fetchdat)
|
|||
uint32_t temp, temp2;
|
||||
|
||||
fetch_ea_32(fetchdat);
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
temp = geteal(); if (cpu_state.abrt) return 1;
|
||||
OP_SHIFT_l(c, 1);
|
||||
return 0;
|
||||
|
|
@ -427,6 +451,8 @@ static int opD2_a16(uint32_t fetchdat)
|
|||
uint8_t temp, temp2;
|
||||
|
||||
fetch_ea_16(fetchdat);
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
c = CL & 31;
|
||||
temp = geteab(); if (cpu_state.abrt) return 1;
|
||||
OP_SHIFT_b(c, 0);
|
||||
|
|
@ -439,6 +465,8 @@ static int opD2_a32(uint32_t fetchdat)
|
|||
uint8_t temp, temp2;
|
||||
|
||||
fetch_ea_32(fetchdat);
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
c = CL & 31;
|
||||
temp = geteab(); if (cpu_state.abrt) return 1;
|
||||
OP_SHIFT_b(c, 1);
|
||||
|
|
@ -451,6 +479,8 @@ static int opD3_w_a16(uint32_t fetchdat)
|
|||
uint16_t temp, temp2;
|
||||
|
||||
fetch_ea_16(fetchdat);
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
c = CL & 31;
|
||||
temp = geteaw(); if (cpu_state.abrt) return 1;
|
||||
OP_SHIFT_w(c, 0);
|
||||
|
|
@ -463,6 +493,8 @@ static int opD3_w_a32(uint32_t fetchdat)
|
|||
uint16_t temp, temp2;
|
||||
|
||||
fetch_ea_32(fetchdat);
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
c = CL & 31;
|
||||
temp = geteaw(); if (cpu_state.abrt) return 1;
|
||||
OP_SHIFT_w(c, 1);
|
||||
|
|
@ -475,6 +507,8 @@ static int opD3_l_a16(uint32_t fetchdat)
|
|||
uint32_t temp, temp2;
|
||||
|
||||
fetch_ea_16(fetchdat);
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
c = CL & 31;
|
||||
temp = geteal(); if (cpu_state.abrt) return 1;
|
||||
OP_SHIFT_l(c, 0);
|
||||
|
|
@ -487,6 +521,8 @@ static int opD3_l_a32(uint32_t fetchdat)
|
|||
uint32_t temp, temp2;
|
||||
|
||||
fetch_ea_32(fetchdat);
|
||||
if (cpu_mod != 3)
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
c = CL & 31;
|
||||
temp = geteal(); if (cpu_state.abrt) return 1;
|
||||
OP_SHIFT_l(c, 1);
|
||||
|
|
@ -552,6 +588,8 @@ static int opD3_l_a32(uint32_t fetchdat)
|
|||
int count; \
|
||||
\
|
||||
fetch_ea_16(fetchdat); \
|
||||
if (cpu_mod != 3) \
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg); \
|
||||
count = getbyte() & 31; \
|
||||
operation(); \
|
||||
\
|
||||
|
|
@ -564,6 +602,8 @@ static int opD3_l_a32(uint32_t fetchdat)
|
|||
int count; \
|
||||
\
|
||||
fetch_ea_16(fetchdat); \
|
||||
if (cpu_mod != 3) \
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg); \
|
||||
count = CL & 31; \
|
||||
operation(); \
|
||||
\
|
||||
|
|
@ -576,6 +616,8 @@ static int opD3_l_a32(uint32_t fetchdat)
|
|||
int count; \
|
||||
\
|
||||
fetch_ea_32(fetchdat); \
|
||||
if (cpu_mod != 3) \
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg); \
|
||||
count = getbyte() & 31; \
|
||||
operation(); \
|
||||
\
|
||||
|
|
@ -588,6 +630,8 @@ static int opD3_l_a32(uint32_t fetchdat)
|
|||
int count; \
|
||||
\
|
||||
fetch_ea_32(fetchdat); \
|
||||
if (cpu_mod != 3) \
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg); \
|
||||
count = CL & 31; \
|
||||
operation(); \
|
||||
\
|
||||
|
|
|
|||
Loading…
Reference in a new issue