Moved integer registers, PC and flags_* variables into new cpu_state structure. Reduces recompiled code size slightly, small speedup (1-3%).

This commit is contained in:
SarahW 2016-04-20 21:39:41 +01:00
commit c81a91fd72
52 changed files with 1494 additions and 1408 deletions

View file

@ -3,7 +3,7 @@ static int opCMPXCHG_b_a16(uint32_t fetchdat)
uint8_t temp, temp2 = AL;
if (!is486)
{
pc = oldpc;
cpu_state.pc = oldpc;
x86illegal();
return 1;
}
@ -21,7 +21,7 @@ static int opCMPXCHG_b_a32(uint32_t fetchdat)
uint8_t temp, temp2 = AL;
if (!is486)
{
pc = oldpc;
cpu_state.pc = oldpc;
x86illegal();
return 1;
}
@ -40,13 +40,13 @@ static int opCMPXCHG_w_a16(uint32_t fetchdat)
uint16_t temp, temp2 = AX;
if (!is486)
{
pc = oldpc;
cpu_state.pc = oldpc;
x86illegal();
return 1;
}
fetch_ea_16(fetchdat);
temp = geteaw(); if (abrt) return 1;
if (AX == temp) seteaw(regs[reg].w);
if (AX == temp) seteaw(cpu_state.regs[reg].w);
else AX = temp;
if (abrt) return 1;
setsub16(temp2, temp);
@ -58,13 +58,13 @@ static int opCMPXCHG_w_a32(uint32_t fetchdat)
uint16_t temp, temp2 = AX;
if (!is486)
{
pc = oldpc;
cpu_state.pc = oldpc;
x86illegal();
return 1;
}
fetch_ea_32(fetchdat);
temp = geteaw(); if (abrt) return 1;
if (AX == temp) seteaw(regs[reg].w);
if (AX == temp) seteaw(cpu_state.regs[reg].w);
else AX = temp;
if (abrt) return 1;
setsub16(temp2, temp);
@ -77,13 +77,13 @@ static int opCMPXCHG_l_a16(uint32_t fetchdat)
uint32_t temp, temp2 = EAX;
if (!is486)
{
pc = oldpc;
cpu_state.pc = oldpc;
x86illegal();
return 1;
}
fetch_ea_16(fetchdat);
temp = geteal(); if (abrt) return 1;
if (EAX == temp) seteal(regs[reg].l);
if (EAX == temp) seteal(cpu_state.regs[reg].l);
else EAX = temp;
if (abrt) return 1;
setsub32(temp2, temp);
@ -95,13 +95,13 @@ static int opCMPXCHG_l_a32(uint32_t fetchdat)
uint32_t temp, temp2 = EAX;
if (!is486)
{
pc = oldpc;
cpu_state.pc = oldpc;
x86illegal();
return 1;
}
fetch_ea_32(fetchdat);
temp = geteal(); if (abrt) return 1;
if (EAX == temp) seteal(regs[reg].l);
if (EAX == temp) seteal(cpu_state.regs[reg].l);
else EAX = temp;
if (abrt) return 1;
setsub32(temp2, temp);
@ -114,7 +114,7 @@ static int opCMPXCHG8B_a16(uint32_t fetchdat)
uint32_t temp, temp_hi, temp2 = EAX, temp2_hi = EDX;
if (!is486)
{
pc = oldpc;
cpu_state.pc = oldpc;
x86illegal();
return 0;
}
@ -145,7 +145,7 @@ static int opCMPXCHG8B_a32(uint32_t fetchdat)
uint32_t temp, temp_hi, temp2 = EAX, temp2_hi = EDX;
if (!is486)
{
pc = oldpc;
cpu_state.pc = oldpc;
x86illegal();
return 0;
}
@ -177,7 +177,7 @@ static int opXADD_b_a16(uint32_t fetchdat)
uint8_t temp;
if (!is486)
{
pc = oldpc;
cpu_state.pc = oldpc;
x86illegal();
return 1;
}
@ -194,7 +194,7 @@ static int opXADD_b_a32(uint32_t fetchdat)
uint8_t temp;
if (!is486)
{
pc = oldpc;
cpu_state.pc = oldpc;
x86illegal();
return 1;
}
@ -212,15 +212,15 @@ static int opXADD_w_a16(uint32_t fetchdat)
uint16_t temp;
if (!is486)
{
pc = oldpc;
cpu_state.pc = oldpc;
x86illegal();
return 1;
}
fetch_ea_16(fetchdat);
temp = geteaw(); if (abrt) return 1;
seteaw(temp + regs[reg].w); if (abrt) return 1;
setadd16(temp, regs[reg].w);
regs[reg].w = temp;
seteaw(temp + cpu_state.regs[reg].w); if (abrt) return 1;
setadd16(temp, cpu_state.regs[reg].w);
cpu_state.regs[reg].w = temp;
CLOCK_CYCLES((mod == 3) ? 3 : 4);
return 0;
}
@ -229,15 +229,15 @@ static int opXADD_w_a32(uint32_t fetchdat)
uint16_t temp;
if (!is486)
{
pc = oldpc;
cpu_state.pc = oldpc;
x86illegal();
return 1;
}
fetch_ea_32(fetchdat);
temp = geteaw(); if (abrt) return 1;
seteaw(temp + regs[reg].w); if (abrt) return 1;
setadd16(temp, regs[reg].w);
regs[reg].w = temp;
seteaw(temp + cpu_state.regs[reg].w); if (abrt) return 1;
setadd16(temp, cpu_state.regs[reg].w);
cpu_state.regs[reg].w = temp;
CLOCK_CYCLES((mod == 3) ? 3 : 4);
return 0;
}
@ -247,15 +247,15 @@ static int opXADD_l_a16(uint32_t fetchdat)
uint32_t temp;
if (!is486)
{
pc = oldpc;
cpu_state.pc = oldpc;
x86illegal();
return 1;
}
fetch_ea_16(fetchdat);
temp = geteal(); if (abrt) return 1;
seteal(temp + regs[reg].l); if (abrt) return 1;
setadd32(temp, regs[reg].l);
regs[reg].l = temp;
seteal(temp + cpu_state.regs[reg].l); if (abrt) return 1;
setadd32(temp, cpu_state.regs[reg].l);
cpu_state.regs[reg].l = temp;
CLOCK_CYCLES((mod == 3) ? 3 : 4);
return 0;
}
@ -264,15 +264,15 @@ static int opXADD_l_a32(uint32_t fetchdat)
uint32_t temp;
if (!is486)
{
pc = oldpc;
cpu_state.pc = oldpc;
x86illegal();
return 1;
}
fetch_ea_32(fetchdat);
temp = geteal(); if (abrt) return 1;
seteal(temp + regs[reg].l); if (abrt) return 1;
setadd32(temp, regs[reg].l);
regs[reg].l = temp;
seteal(temp + cpu_state.regs[reg].l); if (abrt) return 1;
setadd32(temp, cpu_state.regs[reg].l);
cpu_state.regs[reg].l = temp;
CLOCK_CYCLES((mod == 3) ? 3 : 4);
return 0;
}