Applied all applicable PCem commit;
Fixed window resizing when mandated by the guest - should hopefully stabilize Direct3D.
This commit is contained in:
@@ -201,6 +201,21 @@ void x86_int(int num)
|
||||
}
|
||||
else
|
||||
{
|
||||
addr = (num << 2) + idt.base;
|
||||
|
||||
if (addr + 3 > idt.limit)
|
||||
{
|
||||
if(idt.limit < 35)
|
||||
{
|
||||
cpu_state.abrt = 0;
|
||||
softresetx86();
|
||||
cpu_set_edx();
|
||||
pclog("IDT limit is less than 35 in real mode - reset\n");
|
||||
}
|
||||
else x86_int(8);
|
||||
return;
|
||||
}
|
||||
|
||||
if (stack32)
|
||||
{
|
||||
writememw(ss,ESP-2,flags);
|
||||
@@ -215,7 +230,6 @@ void x86_int(int num)
|
||||
writememw(ss,((SP-6)&0xFFFF),cpu_state.pc);
|
||||
SP-=6;
|
||||
}
|
||||
addr = (num << 2) + idt.base;
|
||||
|
||||
flags&=~I_FLAG;
|
||||
flags&=~T_FLAG;
|
||||
@@ -238,6 +252,14 @@ void x86_int_sw(int num)
|
||||
}
|
||||
else
|
||||
{
|
||||
addr = (num << 2) + idt.base;
|
||||
|
||||
if (addr + 3 > idt.limit)
|
||||
{
|
||||
x86_int(13);
|
||||
return;
|
||||
}
|
||||
|
||||
if (stack32)
|
||||
{
|
||||
writememw(ss,ESP-2,flags);
|
||||
@@ -252,7 +274,6 @@ void x86_int_sw(int num)
|
||||
writememw(ss,((SP-6)&0xFFFF),cpu_state.pc);
|
||||
SP-=6;
|
||||
}
|
||||
addr = (num << 2) + idt.base;
|
||||
|
||||
flags&=~I_FLAG;
|
||||
flags&=~T_FLAG;
|
||||
|
||||
@@ -587,7 +587,6 @@ void resetx86()
|
||||
use32=0;
|
||||
cpu_cur_status = 0;
|
||||
stack32=0;
|
||||
cpu_state.pc=0;
|
||||
msr.fcr = (1 << 8) | (1 << 9) | (1 << 12) | (1 << 16) | (1 << 19) | (1 << 21);
|
||||
msw=0;
|
||||
if (is486)
|
||||
@@ -599,9 +598,20 @@ void resetx86()
|
||||
cr4 = 0;
|
||||
eflags=0;
|
||||
cgate32=0;
|
||||
loadcs(0xFFFF);
|
||||
rammask = AT ? 0xFFFFFFFF : 0xfffff;
|
||||
if(AT)
|
||||
{
|
||||
loadcs(cpu_16bitbus ? 0xFF000 : 0xFFFF000);
|
||||
cpu_state.pc=0xFFF0;
|
||||
rammask = cpu_16bitbus ? 0xFFFFFF : 0xFFFFFFFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
loadcs(0xFFFF);
|
||||
cpu_state.pc=0;
|
||||
rammask = 0xfffff;
|
||||
}
|
||||
idt.base = 0;
|
||||
idt.limit = 0xFFFF;
|
||||
flags=2;
|
||||
makeznptable();
|
||||
resetreadlookup();
|
||||
@@ -628,16 +638,27 @@ void softresetx86()
|
||||
use32=0;
|
||||
stack32=0;
|
||||
cpu_cur_status = 0;
|
||||
cpu_state.pc=0;
|
||||
msr.fcr = (1 << 8) | (1 << 9) | (1 << 12) | (1 << 16) | (1 << 19) | (1 << 21);
|
||||
msw=0;
|
||||
cr0=0;
|
||||
cr4 = 0;
|
||||
eflags=0;
|
||||
cgate32=0;
|
||||
loadcs(0xFFFF);
|
||||
if(AT)
|
||||
{
|
||||
loadcs(cpu_16bitbus ? 0xFF000 : 0xFFFF000);
|
||||
cpu_state.pc=0xFFF0;
|
||||
rammask = cpu_16bitbus ? 0xFFFFFF : 0xFFFFFFFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
loadcs(0xFFFF);
|
||||
cpu_state.pc=0;
|
||||
rammask = 0xfffff;
|
||||
}
|
||||
flags=2;
|
||||
idt.base = 0;
|
||||
idt.limit = 0xFFFF;
|
||||
x86seg_reset();
|
||||
x86_was_reset = 1;
|
||||
port_92_clear_reset();
|
||||
@@ -2537,9 +2558,17 @@ void execx86(int cycs)
|
||||
cycles-=((cpu_mod==3)?8:28);
|
||||
break;
|
||||
case 0x20: case 0x30: /*SHL b,CL*/
|
||||
if ((temp<<(c-1))&0x80) flags|=C_FLAG;
|
||||
else flags&=~C_FLAG;
|
||||
temp<<=c;
|
||||
if (c > 8)
|
||||
{
|
||||
temp = 0;
|
||||
flags &= ~C_FLAG;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((temp<<(c-1))&0x80) flags|=C_FLAG;
|
||||
else flags&=~C_FLAG;
|
||||
temp<<=c;
|
||||
}
|
||||
seteab(temp);
|
||||
setznp8(temp);
|
||||
cycles-=(c*4);
|
||||
@@ -2547,9 +2576,17 @@ void execx86(int cycs)
|
||||
flags|=A_FLAG;
|
||||
break;
|
||||
case 0x28: /*SHR b,CL*/
|
||||
if ((temp>>(c-1))&1) flags|=C_FLAG;
|
||||
else flags&=~C_FLAG;
|
||||
temp>>=c;
|
||||
if (c > 8)
|
||||
{
|
||||
temp = 0;
|
||||
flags &= ~C_FLAG;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((temp>>(c-1))&1) flags|=C_FLAG;
|
||||
else flags&=~C_FLAG;
|
||||
temp>>=c;
|
||||
}
|
||||
seteab(temp);
|
||||
setznp8(temp);
|
||||
cycles-=(c*4);
|
||||
@@ -2680,9 +2717,17 @@ void execx86(int cycs)
|
||||
break;
|
||||
|
||||
case 0x28: /*SHR w,CL*/
|
||||
if ((tempw>>(c-1))&1) flags|=C_FLAG;
|
||||
else flags&=~C_FLAG;
|
||||
tempw>>=c;
|
||||
if (c > 16)
|
||||
{
|
||||
tempw = 0;
|
||||
flags &= ~C_FLAG;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((tempw>>(c-1))&1) flags|=C_FLAG;
|
||||
else flags&=~C_FLAG;
|
||||
tempw>>=c;
|
||||
}
|
||||
seteaw(tempw);
|
||||
setznp16(tempw);
|
||||
cycles-=(c*4);
|
||||
|
||||
@@ -251,6 +251,7 @@ static int opMOV_AL_a16(uint32_t fetchdat)
|
||||
{
|
||||
uint8_t temp;
|
||||
uint16_t addr = getwordf();
|
||||
CHECK_READ(cpu_state.ea_seg, addr, addr);
|
||||
temp = readmemb(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1;
|
||||
AL = temp;
|
||||
CLOCK_CYCLES((is486) ? 1 : 4);
|
||||
@@ -261,6 +262,7 @@ static int opMOV_AL_a32(uint32_t fetchdat)
|
||||
{
|
||||
uint8_t temp;
|
||||
uint32_t addr = getlong();
|
||||
CHECK_READ(cpu_state.ea_seg, addr, addr);
|
||||
temp = readmemb(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1;
|
||||
AL = temp;
|
||||
CLOCK_CYCLES((is486) ? 1 : 4);
|
||||
@@ -271,6 +273,7 @@ static int opMOV_AX_a16(uint32_t fetchdat)
|
||||
{
|
||||
uint16_t temp;
|
||||
uint16_t addr = getwordf();
|
||||
CHECK_READ(cpu_state.ea_seg, addr, addr + 1);
|
||||
temp = readmemw(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1;
|
||||
AX = temp;
|
||||
CLOCK_CYCLES((is486) ? 1 : 4);
|
||||
@@ -281,6 +284,7 @@ static int opMOV_AX_a32(uint32_t fetchdat)
|
||||
{
|
||||
uint16_t temp;
|
||||
uint32_t addr = getlong();
|
||||
CHECK_READ(cpu_state.ea_seg, addr, addr + 1);
|
||||
temp = readmemw(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1;
|
||||
AX = temp;
|
||||
CLOCK_CYCLES((is486) ? 1 : 4);
|
||||
@@ -291,6 +295,7 @@ static int opMOV_EAX_a16(uint32_t fetchdat)
|
||||
{
|
||||
uint32_t temp;
|
||||
uint16_t addr = getwordf();
|
||||
CHECK_READ(cpu_state.ea_seg, addr, addr + 3);
|
||||
temp = readmeml(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1;
|
||||
EAX = temp;
|
||||
CLOCK_CYCLES((is486) ? 1 : 4);
|
||||
@@ -301,6 +306,7 @@ static int opMOV_EAX_a32(uint32_t fetchdat)
|
||||
{
|
||||
uint32_t temp;
|
||||
uint32_t addr = getlong();
|
||||
CHECK_READ(cpu_state.ea_seg, addr, addr + 3);
|
||||
temp = readmeml(cpu_state.ea_seg->base, addr); if (cpu_state.abrt) return 1;
|
||||
EAX = temp;
|
||||
CLOCK_CYCLES((is486) ? 1 : 4);
|
||||
@@ -311,6 +317,7 @@ static int opMOV_EAX_a32(uint32_t fetchdat)
|
||||
static int opMOV_a16_AL(uint32_t fetchdat)
|
||||
{
|
||||
uint16_t addr = getwordf();
|
||||
CHECK_WRITE(cpu_state.ea_seg, addr, addr);
|
||||
writememb(cpu_state.ea_seg->base, addr, AL);
|
||||
CLOCK_CYCLES((is486) ? 1 : 2);
|
||||
PREFETCH_RUN(2, 3, -1, 0,0,1,0, 0);
|
||||
@@ -319,6 +326,7 @@ static int opMOV_a16_AL(uint32_t fetchdat)
|
||||
static int opMOV_a32_AL(uint32_t fetchdat)
|
||||
{
|
||||
uint32_t addr = getlong();
|
||||
CHECK_WRITE(cpu_state.ea_seg, addr, addr);
|
||||
writememb(cpu_state.ea_seg->base, addr, AL);
|
||||
CLOCK_CYCLES((is486) ? 1 : 2);
|
||||
PREFETCH_RUN(2, 5, -1, 0,0,1,0, 1);
|
||||
@@ -327,6 +335,7 @@ static int opMOV_a32_AL(uint32_t fetchdat)
|
||||
static int opMOV_a16_AX(uint32_t fetchdat)
|
||||
{
|
||||
uint16_t addr = getwordf();
|
||||
CHECK_WRITE(cpu_state.ea_seg, addr, addr + 1);
|
||||
writememw(cpu_state.ea_seg->base, addr, AX);
|
||||
CLOCK_CYCLES((is486) ? 1 : 2);
|
||||
PREFETCH_RUN(2, 3, -1, 0,0,1,0, 0);
|
||||
@@ -335,6 +344,7 @@ static int opMOV_a16_AX(uint32_t fetchdat)
|
||||
static int opMOV_a32_AX(uint32_t fetchdat)
|
||||
{
|
||||
uint32_t addr = getlong(); if (cpu_state.abrt) return 1;
|
||||
CHECK_WRITE(cpu_state.ea_seg, addr, addr + 1);
|
||||
writememw(cpu_state.ea_seg->base, addr, AX);
|
||||
CLOCK_CYCLES((is486) ? 1 : 2);
|
||||
PREFETCH_RUN(2, 5, -1, 0,0,1,0, 1);
|
||||
@@ -343,6 +353,7 @@ static int opMOV_a32_AX(uint32_t fetchdat)
|
||||
static int opMOV_a16_EAX(uint32_t fetchdat)
|
||||
{
|
||||
uint16_t addr = getwordf();
|
||||
CHECK_WRITE(cpu_state.ea_seg, addr, addr + 3);
|
||||
writememl(cpu_state.ea_seg->base, addr, EAX);
|
||||
CLOCK_CYCLES((is486) ? 1 : 2);
|
||||
PREFETCH_RUN(2, 3, -1, 0,0,0,1, 0);
|
||||
@@ -351,6 +362,7 @@ static int opMOV_a16_EAX(uint32_t fetchdat)
|
||||
static int opMOV_a32_EAX(uint32_t fetchdat)
|
||||
{
|
||||
uint32_t addr = getlong(); if (cpu_state.abrt) return 1;
|
||||
CHECK_WRITE(cpu_state.ea_seg, addr, addr + 3);
|
||||
writememl(cpu_state.ea_seg->base, addr, EAX);
|
||||
CLOCK_CYCLES((is486) ? 1 : 2);
|
||||
PREFETCH_RUN(2, 5, -1, 0,0,0,1, 1);
|
||||
|
||||
@@ -542,7 +542,7 @@ void loadcs(uint16_t seg)
|
||||
_cs.limit=0xFFFF;
|
||||
_cs.limit_low = 0;
|
||||
_cs.limit_high = 0xffff;
|
||||
CS=seg;
|
||||
CS=seg & 0xFFFF;
|
||||
if (eflags&VM_FLAG) _cs.access=(3<<5) | 2 | 0x80;
|
||||
else _cs.access=(0<<5) | 2 | 0x80;
|
||||
if (CPL==3 && oldcpl!=3) flushmmucache_cr3();
|
||||
|
||||
Reference in New Issue
Block a user