Implemented IDT limit checking on real mode interrupts. Patch from Greatpsycho.
This commit is contained in:
parent
6798ebf0a6
commit
f336dd9589
1 changed files with 57 additions and 33 deletions
|
|
@ -197,6 +197,22 @@ void x86_int(int num)
|
||||||
pmodeint(num,0);
|
pmodeint(num,0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
addr = (num << 2) + idt.base;
|
||||||
|
|
||||||
|
if ((num << 2) + 3 > idt.limit)
|
||||||
|
{
|
||||||
|
if (idt.limit < 35)
|
||||||
|
{
|
||||||
|
cpu_state.abrt = 0;
|
||||||
|
softresetx86();
|
||||||
|
cpu_set_edx();
|
||||||
|
pclog("Triple fault in real mode - reset\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
x86_int(8);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (stack32)
|
if (stack32)
|
||||||
{
|
{
|
||||||
|
|
@ -212,7 +228,6 @@ void x86_int(int num)
|
||||||
writememw(ss,((SP-6)&0xFFFF),cpu_state.pc);
|
writememw(ss,((SP-6)&0xFFFF),cpu_state.pc);
|
||||||
SP-=6;
|
SP-=6;
|
||||||
}
|
}
|
||||||
addr = (num << 2) + idt.base;
|
|
||||||
|
|
||||||
flags&=~I_FLAG;
|
flags&=~I_FLAG;
|
||||||
flags&=~T_FLAG;
|
flags&=~T_FLAG;
|
||||||
|
|
@ -220,6 +235,7 @@ void x86_int(int num)
|
||||||
cpu_state.pc=readmemw(0,addr);
|
cpu_state.pc=readmemw(0,addr);
|
||||||
loadcs(readmemw(0,addr+2));
|
loadcs(readmemw(0,addr+2));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
cycles-=70;
|
cycles-=70;
|
||||||
CPU_BLOCK_END();
|
CPU_BLOCK_END();
|
||||||
}
|
}
|
||||||
|
|
@ -236,6 +252,14 @@ void x86_int_sw(int num)
|
||||||
pmodeint(num,1);
|
pmodeint(num,1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
addr = (num << 2) + idt.base;
|
||||||
|
|
||||||
|
if ((num << 2) + 3 > idt.limit)
|
||||||
|
{
|
||||||
|
x86_int(13);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (stack32)
|
if (stack32)
|
||||||
{
|
{
|
||||||
|
|
@ -251,7 +275,6 @@ void x86_int_sw(int num)
|
||||||
writememw(ss,((SP-6)&0xFFFF),cpu_state.pc);
|
writememw(ss,((SP-6)&0xFFFF),cpu_state.pc);
|
||||||
SP-=6;
|
SP-=6;
|
||||||
}
|
}
|
||||||
addr = (num << 2) + idt.base;
|
|
||||||
|
|
||||||
flags&=~I_FLAG;
|
flags&=~I_FLAG;
|
||||||
flags&=~T_FLAG;
|
flags&=~T_FLAG;
|
||||||
|
|
@ -260,6 +283,7 @@ void x86_int_sw(int num)
|
||||||
loadcs(readmemw(0,addr+2));
|
loadcs(readmemw(0,addr+2));
|
||||||
cycles -= timing_int_rm;
|
cycles -= timing_int_rm;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
trap = 0;
|
trap = 0;
|
||||||
CPU_BLOCK_END();
|
CPU_BLOCK_END();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue