Moved more variables into cpu_state structure.

This commit is contained in:
SarahW 2016-08-21 21:28:23 +01:00
commit eb126fd822
50 changed files with 1454 additions and 1481 deletions

View file

@ -5,7 +5,7 @@
static int rounding_modes[4] = {FE_TONEAREST, FE_DOWNWARD, FE_UPWARD, FE_TOWARDZERO};
#define ST(x) ST[((TOP+(x))&7)]
#define ST(x) ST[((cpu_state.TOP+(x))&7)]
#define C0 (1<<8)
#define C1 (1<<9)
@ -34,15 +34,15 @@ static int rounding_modes[4] = {FE_TONEAREST, FE_DOWNWARD, FE_UPWARD, FE_TOWARDZ
static inline void x87_set_mmx()
{
TOP = 0;
*(uint64_t *)tag = 0;
ismmx = 1;
cpu_state.TOP = 0;
*(uint64_t *)cpu_state.tag = 0;
cpu_state.ismmx = 1;
}
static inline void x87_emms()
{
*tag = 0x0303030303030303ll;
ismmx = 0;
*cpu_state.tag = 0x0303030303030303ll;
cpu_state.ismmx = 0;
}
static inline void x87_checkexceptions()
@ -51,16 +51,16 @@ static inline void x87_checkexceptions()
static inline void x87_push(double i)
{
TOP=(TOP-1)&7;
ST[TOP]=i;
tag[TOP&7] = (i == 0.0) ? 1 : 0;
cpu_state.TOP=(cpu_state.TOP-1)&7;
ST[cpu_state.TOP]=i;
cpu_state.tag[cpu_state.TOP&7] = (i == 0.0) ? 1 : 0;
}
static inline double x87_pop()
{
double t=ST[TOP];
tag[TOP&7] = 3;
TOP=(TOP+1)&7;
double t=ST[cpu_state.TOP];
cpu_state.tag[cpu_state.TOP&7] = 3;
cpu_state.TOP=(cpu_state.TOP+1)&7;
return t;
}
@ -163,12 +163,12 @@ static inline void x87_st80(double d)
static inline void x87_st_fsave(int reg)
{
reg = (TOP + reg) & 7;
reg = (cpu_state.TOP + reg) & 7;
if (tag[reg] & TAG_UINT64)
if (cpu_state.tag[reg] & TAG_UINT64)
{
writememl(easeg, cpu_state.eaaddr, ST_i64[reg] & 0xffffffff);
writememl(easeg, cpu_state.eaaddr + 4, ST_i64[reg] >> 32);
writememl(easeg, cpu_state.eaaddr, MM[reg].q & 0xffffffff);
writememl(easeg, cpu_state.eaaddr + 4, MM[reg].q >> 32);
writememw(easeg, cpu_state.eaaddr + 8, 0x5555);
}
else
@ -179,16 +179,16 @@ static inline void x87_ld_frstor(int reg)
{
uint16_t temp;
reg = (TOP + reg) & 7;
reg = (cpu_state.TOP + reg) & 7;
temp = readmemw(easeg, cpu_state.eaaddr + 8);
if (temp == 0x5555 && tag[reg] == 2)
if (temp == 0x5555 && cpu_state.tag[reg] == 2)
{
tag[reg] = TAG_UINT64;
ST_i64[reg] = readmeml(easeg, cpu_state.eaaddr);
ST_i64[reg] |= ((uint64_t)readmeml(easeg, cpu_state.eaaddr + 4) << 32);
ST[reg] = (double)ST_i64[reg];
cpu_state.tag[reg] = TAG_UINT64;
MM[reg].q = readmeml(easeg, cpu_state.eaaddr);
MM[reg].q |= ((uint64_t)readmeml(easeg, cpu_state.eaaddr + 4) << 32);
ST[reg] = (double)MM[reg].q;
}
else
ST[reg] = x87_ld80();