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
|
|
@ -3,6 +3,7 @@ static int opFILDiw_a16(uint32_t fetchdat)
|
|||
int16_t temp;
|
||||
FP_ENTER();
|
||||
fetch_ea_16(fetchdat);
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FILDw %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
temp = geteaw(); if (cpu_state.abrt) return 1;
|
||||
if (fplog) pclog(" %f\n", (double)temp);
|
||||
|
|
@ -15,6 +16,7 @@ static int opFILDiw_a32(uint32_t fetchdat)
|
|||
int16_t temp;
|
||||
FP_ENTER();
|
||||
fetch_ea_32(fetchdat);
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FILDw %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
temp = geteaw(); if (cpu_state.abrt) return 1;
|
||||
if (fplog) pclog(" %f\n", (double)temp);
|
||||
|
|
@ -28,6 +30,7 @@ static int opFISTiw_a16(uint32_t fetchdat)
|
|||
int64_t temp64;
|
||||
FP_ENTER();
|
||||
fetch_ea_16(fetchdat);
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FISTw %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
temp64 = x87_fround(ST(0));
|
||||
/* if (temp64 > 32767 || temp64 < -32768)
|
||||
|
|
@ -41,6 +44,7 @@ static int opFISTiw_a32(uint32_t fetchdat)
|
|||
int64_t temp64;
|
||||
FP_ENTER();
|
||||
fetch_ea_32(fetchdat);
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FISTw %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
temp64 = x87_fround(ST(0));
|
||||
/* if (temp64 > 32767 || temp64 < -32768)
|
||||
|
|
@ -55,6 +59,7 @@ static int opFISTPiw_a16(uint32_t fetchdat)
|
|||
int64_t temp64;
|
||||
FP_ENTER();
|
||||
fetch_ea_16(fetchdat);
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FISTw %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
temp64 = x87_fround(ST(0));
|
||||
/* if (temp64 > 32767 || temp64 < -32768)
|
||||
|
|
@ -69,6 +74,7 @@ static int opFISTPiw_a32(uint32_t fetchdat)
|
|||
int64_t temp64;
|
||||
FP_ENTER();
|
||||
fetch_ea_32(fetchdat);
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FISTw %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
temp64 = x87_fround(ST(0));
|
||||
/* if (temp64 > 32767 || temp64 < -32768)
|
||||
|
|
@ -84,6 +90,7 @@ static int opFILDiq_a16(uint32_t fetchdat)
|
|||
int64_t temp64;
|
||||
FP_ENTER();
|
||||
fetch_ea_16(fetchdat);
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FILDl %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
temp64 = geteaq(); if (cpu_state.abrt) return 1;
|
||||
if (fplog) pclog(" %f %08X %08X\n", (double)temp64, readmeml(easeg,cpu_state.eaaddr), readmeml(easeg,cpu_state.eaaddr+4));
|
||||
|
|
@ -99,6 +106,7 @@ static int opFILDiq_a32(uint32_t fetchdat)
|
|||
int64_t temp64;
|
||||
FP_ENTER();
|
||||
fetch_ea_32(fetchdat);
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FILDl %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
temp64 = geteaq(); if (cpu_state.abrt) return 1;
|
||||
if (fplog) pclog(" %f %08X %08X\n", (double)temp64, readmeml(easeg,cpu_state.eaaddr), readmeml(easeg,cpu_state.eaaddr+4));
|
||||
|
|
@ -116,6 +124,7 @@ static int FBSTP_a16(uint32_t fetchdat)
|
|||
int c;
|
||||
FP_ENTER();
|
||||
fetch_ea_16(fetchdat);
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FBSTP %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
tempd = ST(0);
|
||||
if (tempd < 0.0)
|
||||
|
|
@ -142,6 +151,7 @@ static int FBSTP_a32(uint32_t fetchdat)
|
|||
int c;
|
||||
FP_ENTER();
|
||||
fetch_ea_32(fetchdat);
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FBSTP %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
tempd = ST(0);
|
||||
if (tempd < 0.0)
|
||||
|
|
@ -168,6 +178,7 @@ static int FISTPiq_a16(uint32_t fetchdat)
|
|||
int64_t temp64;
|
||||
FP_ENTER();
|
||||
fetch_ea_16(fetchdat);
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FISTPl %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
if (cpu_state.tag[cpu_state.TOP] & TAG_UINT64)
|
||||
temp64 = cpu_state.MM[cpu_state.TOP].q;
|
||||
|
|
@ -183,6 +194,7 @@ static int FISTPiq_a32(uint32_t fetchdat)
|
|||
int64_t temp64;
|
||||
FP_ENTER();
|
||||
fetch_ea_32(fetchdat);
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FISTPl %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
if (cpu_state.tag[cpu_state.TOP] & TAG_UINT64)
|
||||
temp64 = cpu_state.MM[cpu_state.TOP].q;
|
||||
|
|
@ -199,6 +211,7 @@ static int opFILDil_a16(uint32_t fetchdat)
|
|||
int32_t templ;
|
||||
FP_ENTER();
|
||||
fetch_ea_16(fetchdat);
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FILDs %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
templ = geteal(); if (cpu_state.abrt) return 1;
|
||||
if (fplog) pclog(" %f %08X %i\n", (double)templ, templ, templ);
|
||||
|
|
@ -211,6 +224,7 @@ static int opFILDil_a32(uint32_t fetchdat)
|
|||
int32_t templ;
|
||||
FP_ENTER();
|
||||
fetch_ea_32(fetchdat);
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FILDs %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
templ = geteal(); if (cpu_state.abrt) return 1;
|
||||
if (fplog) pclog(" %f %08X %i\n", (double)templ, templ, templ);
|
||||
|
|
@ -224,6 +238,7 @@ static int opFISTil_a16(uint32_t fetchdat)
|
|||
int64_t temp64;
|
||||
FP_ENTER();
|
||||
fetch_ea_16(fetchdat);
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FISTs %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
temp64 = x87_fround(ST(0));
|
||||
/* if (temp64 > 2147483647 || temp64 < -2147483647)
|
||||
|
|
@ -237,6 +252,7 @@ static int opFISTil_a32(uint32_t fetchdat)
|
|||
int64_t temp64;
|
||||
FP_ENTER();
|
||||
fetch_ea_32(fetchdat);
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FISTs %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
temp64 = x87_fround(ST(0));
|
||||
/* if (temp64 > 2147483647 || temp64 < -2147483647)
|
||||
|
|
@ -251,6 +267,7 @@ static int opFISTPil_a16(uint32_t fetchdat)
|
|||
int64_t temp64;
|
||||
FP_ENTER();
|
||||
fetch_ea_16(fetchdat);
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FISTs %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
temp64 = x87_fround(ST(0));
|
||||
/* if (temp64 > 2147483647 || temp64 < -2147483647)
|
||||
|
|
@ -265,6 +282,7 @@ static int opFISTPil_a32(uint32_t fetchdat)
|
|||
int64_t temp64;
|
||||
FP_ENTER();
|
||||
fetch_ea_32(fetchdat);
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FISTs %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
temp64 = x87_fround(ST(0));
|
||||
/* if (temp64 > 2147483647 || temp64 < -2147483647)
|
||||
|
|
@ -280,6 +298,7 @@ static int opFLDe_a16(uint32_t fetchdat)
|
|||
double t;
|
||||
FP_ENTER();
|
||||
fetch_ea_16(fetchdat);
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FLDe %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
t=x87_ld80(); if (cpu_state.abrt) return 1;
|
||||
if (fplog) pclog(" %f\n", t);
|
||||
|
|
@ -292,6 +311,7 @@ static int opFLDe_a32(uint32_t fetchdat)
|
|||
double t;
|
||||
FP_ENTER();
|
||||
fetch_ea_32(fetchdat);
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FLDe %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
t=x87_ld80(); if (cpu_state.abrt) return 1;
|
||||
if (fplog) pclog(" %f\n", t);
|
||||
|
|
@ -304,6 +324,7 @@ static int opFSTPe_a16(uint32_t fetchdat)
|
|||
{
|
||||
FP_ENTER();
|
||||
fetch_ea_16(fetchdat);
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FSTPe %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
x87_st80(ST(0)); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
|
|
@ -314,6 +335,7 @@ static int opFSTPe_a32(uint32_t fetchdat)
|
|||
{
|
||||
FP_ENTER();
|
||||
fetch_ea_32(fetchdat);
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FSTPe %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
x87_st80(ST(0)); if (cpu_state.abrt) return 1;
|
||||
x87_pop();
|
||||
|
|
@ -326,6 +348,7 @@ static int opFLDd_a16(uint32_t fetchdat)
|
|||
x87_td t;
|
||||
FP_ENTER();
|
||||
fetch_ea_16(fetchdat);
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FLDd %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
t.i = geteaq(); if (cpu_state.abrt) return 1;
|
||||
if (fplog) pclog(" %f\n", t.d);
|
||||
|
|
@ -338,6 +361,7 @@ static int opFLDd_a32(uint32_t fetchdat)
|
|||
x87_td t;
|
||||
FP_ENTER();
|
||||
fetch_ea_32(fetchdat);
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FLDd %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
t.i = geteaq(); if (cpu_state.abrt) return 1;
|
||||
if (fplog) pclog(" %f\n", t.d);
|
||||
|
|
@ -351,6 +375,7 @@ static int opFSTd_a16(uint32_t fetchdat)
|
|||
x87_td t;
|
||||
FP_ENTER();
|
||||
fetch_ea_16(fetchdat);
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FSTd %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
t.d = ST(0);
|
||||
seteaq(t.i);
|
||||
|
|
@ -362,6 +387,7 @@ static int opFSTd_a32(uint32_t fetchdat)
|
|||
x87_td t;
|
||||
FP_ENTER();
|
||||
fetch_ea_32(fetchdat);
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FSTd %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
t.d = ST(0);
|
||||
seteaq(t.i);
|
||||
|
|
@ -374,6 +400,7 @@ static int opFSTPd_a16(uint32_t fetchdat)
|
|||
x87_td t;
|
||||
FP_ENTER();
|
||||
fetch_ea_16(fetchdat);
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
CHECK_WRITE(cpu_state.ea_seg, cpu_state.eaaddr, cpu_state.eaaddr + 7);
|
||||
if (fplog) pclog("FSTd %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
t.d = ST(0);
|
||||
|
|
@ -387,6 +414,7 @@ static int opFSTPd_a32(uint32_t fetchdat)
|
|||
x87_td t;
|
||||
FP_ENTER();
|
||||
fetch_ea_32(fetchdat);
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
CHECK_WRITE(cpu_state.ea_seg, cpu_state.eaaddr, cpu_state.eaaddr + 7);
|
||||
if (fplog) pclog("FSTd %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
t.d = ST(0);
|
||||
|
|
@ -401,6 +429,7 @@ static int opFLDs_a16(uint32_t fetchdat)
|
|||
x87_ts ts;
|
||||
FP_ENTER();
|
||||
fetch_ea_16(fetchdat);
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FLDs %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
ts.i = geteal(); if (cpu_state.abrt) return 1;
|
||||
if (fplog) pclog(" %f\n", ts.s);
|
||||
|
|
@ -413,6 +442,7 @@ static int opFLDs_a32(uint32_t fetchdat)
|
|||
x87_ts ts;
|
||||
FP_ENTER();
|
||||
fetch_ea_32(fetchdat);
|
||||
SEG_CHECK_READ(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FLDs %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
ts.i = geteal(); if (cpu_state.abrt) return 1;
|
||||
if (fplog) pclog(" %f\n", ts.s);
|
||||
|
|
@ -426,6 +456,7 @@ static int opFSTs_a16(uint32_t fetchdat)
|
|||
x87_ts ts;
|
||||
FP_ENTER();
|
||||
fetch_ea_16(fetchdat);
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FSTs %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
ts.s = (float)ST(0);
|
||||
seteal(ts.i);
|
||||
|
|
@ -437,6 +468,7 @@ static int opFSTs_a32(uint32_t fetchdat)
|
|||
x87_ts ts;
|
||||
FP_ENTER();
|
||||
fetch_ea_32(fetchdat);
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FSTs %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
ts.s = (float)ST(0);
|
||||
seteal(ts.i);
|
||||
|
|
@ -449,6 +481,7 @@ static int opFSTPs_a16(uint32_t fetchdat)
|
|||
x87_ts ts;
|
||||
FP_ENTER();
|
||||
fetch_ea_16(fetchdat);
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FSTs %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
ts.s = (float)ST(0);
|
||||
seteal(ts.i); if (cpu_state.abrt) return 1;
|
||||
|
|
@ -461,6 +494,7 @@ static int opFSTPs_a32(uint32_t fetchdat)
|
|||
x87_ts ts;
|
||||
FP_ENTER();
|
||||
fetch_ea_32(fetchdat);
|
||||
SEG_CHECK_WRITE(cpu_state.ea_seg);
|
||||
if (fplog) pclog("FSTs %08X:%08X\n", easeg, cpu_state.eaaddr);
|
||||
ts.s = (float)ST(0);
|
||||
seteal(ts.i); if (cpu_state.abrt) return 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue