Move flags and eflags variables into cpu_struct.
This commit is contained in:
parent
c1565eb42f
commit
a4d3aa1912
25 changed files with 1013 additions and 958 deletions
|
|
@ -1,5 +1,5 @@
|
|||
#define RETF_a16(stack_offset) \
|
||||
if ((msw&1) && !(eflags&VM_FLAG)) \
|
||||
if ((msw&1) && !(cpu_state.eflags&VM_FLAG)) \
|
||||
{ \
|
||||
pmoderetf(0, stack_offset); \
|
||||
return 1; \
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
cycles -= timing_retf_rm;
|
||||
|
||||
#define RETF_a32(stack_offset) \
|
||||
if ((msw&1) && !(eflags&VM_FLAG)) \
|
||||
if ((msw&1) && !(cpu_state.eflags&VM_FLAG)) \
|
||||
{ \
|
||||
pmoderetf(1, stack_offset); \
|
||||
return 1; \
|
||||
|
|
@ -94,7 +94,7 @@ static int opIRET_286(uint32_t fetchdat)
|
|||
{
|
||||
int cycles_old = cycles; UNUSED(cycles_old);
|
||||
|
||||
if ((cr0 & 1) && (eflags & VM_FLAG) && (IOPL != 3))
|
||||
if ((cr0 & 1) && (cpu_state.eflags & VM_FLAG) && (IOPL != 3))
|
||||
{
|
||||
x86gpf(NULL,0);
|
||||
return 1;
|
||||
|
|
@ -113,14 +113,14 @@ static int opIRET_286(uint32_t fetchdat)
|
|||
{
|
||||
cpu_state.pc = readmemw(ss, ESP);
|
||||
new_cs = readmemw(ss, ESP + 2);
|
||||
flags = (flags & 0x7000) | (readmemw(ss, ESP + 4) & 0xffd5) | 2;
|
||||
cpu_state.flags = (cpu_state.flags & 0x7000) | (readmemw(ss, ESP + 4) & 0xffd5) | 2;
|
||||
ESP += 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
cpu_state.pc = readmemw(ss, SP);
|
||||
new_cs = readmemw(ss, ((SP + 2) & 0xffff));
|
||||
flags = (flags & 0x7000) | (readmemw(ss, ((SP + 4) & 0xffff)) & 0x0fd5) | 2;
|
||||
cpu_state.flags = (cpu_state.flags & 0x7000) | (readmemw(ss, ((SP + 4) & 0xffff)) & 0x0fd5) | 2;
|
||||
SP += 6;
|
||||
}
|
||||
loadcs(new_cs);
|
||||
|
|
@ -139,7 +139,7 @@ static int opIRET(uint32_t fetchdat)
|
|||
{
|
||||
int cycles_old = cycles; UNUSED(cycles_old);
|
||||
|
||||
if ((cr0 & 1) && (eflags & VM_FLAG) && (IOPL != 3))
|
||||
if ((cr0 & 1) && (cpu_state.eflags & VM_FLAG) && (IOPL != 3))
|
||||
{
|
||||
if (cr4 & CR4_VME)
|
||||
{
|
||||
|
|
@ -151,17 +151,17 @@ static int opIRET(uint32_t fetchdat)
|
|||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
|
||||
if ((new_flags & T_FLAG) || ((new_flags & I_FLAG) && (eflags & VIP_FLAG)))
|
||||
if ((new_flags & T_FLAG) || ((new_flags & I_FLAG) && (cpu_state.eflags & VIP_FLAG)))
|
||||
{
|
||||
x86gpf(NULL, 0);
|
||||
return 1;
|
||||
}
|
||||
SP += 6;
|
||||
if (new_flags & I_FLAG)
|
||||
eflags |= VIF_FLAG;
|
||||
cpu_state.eflags |= VIF_FLAG;
|
||||
else
|
||||
eflags &= ~VIF_FLAG;
|
||||
flags = (flags & 0x3300) | (new_flags & 0x4cd5) | 2;
|
||||
cpu_state.eflags &= ~VIF_FLAG;
|
||||
cpu_state.flags = (cpu_state.flags & 0x3300) | (new_flags & 0x4cd5) | 2;
|
||||
loadcs(new_cs);
|
||||
cpu_state.pc = new_pc;
|
||||
|
||||
|
|
@ -189,14 +189,14 @@ static int opIRET(uint32_t fetchdat)
|
|||
{
|
||||
cpu_state.pc = readmemw(ss, ESP);
|
||||
new_cs = readmemw(ss, ESP + 2);
|
||||
flags = (readmemw(ss, ESP + 4) & 0xffd5) | 2;
|
||||
cpu_state.flags = (readmemw(ss, ESP + 4) & 0xffd5) | 2;
|
||||
ESP += 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
cpu_state.pc = readmemw(ss, SP);
|
||||
new_cs = readmemw(ss, ((SP + 2) & 0xffff));
|
||||
flags = (readmemw(ss, ((SP + 4) & 0xffff)) & 0xffd5) | 2;
|
||||
cpu_state.flags = (readmemw(ss, ((SP + 4) & 0xffff)) & 0xffd5) | 2;
|
||||
SP += 6;
|
||||
}
|
||||
loadcs(new_cs);
|
||||
|
|
@ -216,7 +216,7 @@ static int opIRETD(uint32_t fetchdat)
|
|||
{
|
||||
int cycles_old = cycles; UNUSED(cycles_old);
|
||||
|
||||
if ((cr0 & 1) && (eflags & VM_FLAG) && (IOPL != 3))
|
||||
if ((cr0 & 1) && (cpu_state.eflags & VM_FLAG) && (IOPL != 3))
|
||||
{
|
||||
x86gpf(NULL,0);
|
||||
return 1;
|
||||
|
|
@ -235,16 +235,16 @@ static int opIRETD(uint32_t fetchdat)
|
|||
{
|
||||
cpu_state.pc = readmeml(ss, ESP);
|
||||
new_cs = readmemw(ss, ESP + 4);
|
||||
flags = (readmemw(ss, ESP + 8) & 0xffd5) | 2;
|
||||
eflags = readmemw(ss, ESP + 10);
|
||||
cpu_state.flags = (readmemw(ss, ESP + 8) & 0xffd5) | 2;
|
||||
cpu_state.eflags = readmemw(ss, ESP + 10);
|
||||
ESP += 12;
|
||||
}
|
||||
else
|
||||
{
|
||||
cpu_state.pc = readmeml(ss, SP);
|
||||
new_cs = readmemw(ss, ((SP + 4) & 0xffff));
|
||||
flags = (readmemw(ss,(SP + 8) & 0xffff) & 0xffd5) | 2;
|
||||
eflags = readmemw(ss, (SP + 10) & 0xffff);
|
||||
cpu_state.flags = (readmemw(ss,(SP + 8) & 0xffff) & 0xffd5) | 2;
|
||||
cpu_state.eflags = readmemw(ss, (SP + 10) & 0xffff);
|
||||
SP += 12;
|
||||
}
|
||||
loadcs(new_cs);
|
||||
|
|
|
|||
Loading…
Reference in a new issue