mirror of
https://github.com/reactos/reactos.git
synced 2024-07-06 20:55:16 +00:00
[FAST486]
- Fix interrupts in V86 mode. - CLI and STI should call Fast486GetCurrentPrivLevel in their IOPL check, since it always returns 3 if the VM flag is set. svn path=/trunk/; revision=65447
This commit is contained in:
parent
e9b8b6f597
commit
9f8411bf3a
|
@ -294,8 +294,9 @@ Fast486InterruptInternal(PFAST486_STATE State,
|
||||||
State->PrefixFlags |= FAST486_PREFIX_OPSIZE;
|
State->PrefixFlags |= FAST486_PREFIX_OPSIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the interrupt handler is more privileged */
|
/* Check if the interrupt handler is more privileged or if we're in V86 mode */
|
||||||
if (Fast486GetCurrentPrivLevel(State) > GET_SEGMENT_RPL(SegmentSelector))
|
if ((Fast486GetCurrentPrivLevel(State) > GET_SEGMENT_RPL(SegmentSelector))
|
||||||
|
|| State->Flags.Vm)
|
||||||
{
|
{
|
||||||
/* Read the TSS */
|
/* Read the TSS */
|
||||||
if (!Fast486ReadLinearMemory(State,
|
if (!Fast486ReadLinearMemory(State,
|
||||||
|
@ -310,6 +311,24 @@ Fast486InterruptInternal(PFAST486_STATE State,
|
||||||
/* Switch to the new privilege level */
|
/* Switch to the new privilege level */
|
||||||
State->Cpl = GET_SEGMENT_RPL(SegmentSelector);
|
State->Cpl = GET_SEGMENT_RPL(SegmentSelector);
|
||||||
|
|
||||||
|
if (State->Flags.Vm)
|
||||||
|
{
|
||||||
|
/* Clear the VM flag */
|
||||||
|
State->Flags.Vm = FALSE;
|
||||||
|
|
||||||
|
/* Push GS, FS, DS and ES */
|
||||||
|
if (!Fast486StackPush(State, State->SegmentRegs[FAST486_REG_GS].Selector)) goto Cleanup;
|
||||||
|
if (!Fast486StackPush(State, State->SegmentRegs[FAST486_REG_FS].Selector)) goto Cleanup;
|
||||||
|
if (!Fast486StackPush(State, State->SegmentRegs[FAST486_REG_DS].Selector)) goto Cleanup;
|
||||||
|
if (!Fast486StackPush(State, State->SegmentRegs[FAST486_REG_ES].Selector)) goto Cleanup;
|
||||||
|
|
||||||
|
/* Now load them with NULL selectors, since they are useless in protected mode */
|
||||||
|
if (!Fast486LoadSegment(State, FAST486_REG_GS, 0)) goto Cleanup;
|
||||||
|
if (!Fast486LoadSegment(State, FAST486_REG_FS, 0)) goto Cleanup;
|
||||||
|
if (!Fast486LoadSegment(State, FAST486_REG_DS, 0)) goto Cleanup;
|
||||||
|
if (!Fast486LoadSegment(State, FAST486_REG_ES, 0)) goto Cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check the new (higher) privilege level */
|
/* Check the new (higher) privilege level */
|
||||||
switch (State->Cpl)
|
switch (State->Cpl)
|
||||||
{
|
{
|
||||||
|
|
|
@ -754,7 +754,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeClearInt)
|
||||||
if (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PE)
|
if (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PE)
|
||||||
{
|
{
|
||||||
/* Check IOPL */
|
/* Check IOPL */
|
||||||
if (State->Flags.Iopl >= State->SegmentRegs[FAST486_REG_CS].Dpl)
|
if (State->Flags.Iopl >= Fast486GetCurrentPrivLevel(State))
|
||||||
{
|
{
|
||||||
/* Clear the interrupt flag */
|
/* Clear the interrupt flag */
|
||||||
State->Flags.If = FALSE;
|
State->Flags.If = FALSE;
|
||||||
|
@ -789,7 +789,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeSetInt)
|
||||||
if (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PE)
|
if (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PE)
|
||||||
{
|
{
|
||||||
/* Check IOPL */
|
/* Check IOPL */
|
||||||
if (State->Flags.Iopl >= State->SegmentRegs[FAST486_REG_CS].Dpl)
|
if (State->Flags.Iopl >= Fast486GetCurrentPrivLevel(State))
|
||||||
{
|
{
|
||||||
/* Set the interrupt flag */
|
/* Set the interrupt flag */
|
||||||
State->Flags.If = TRUE;
|
State->Flags.If = TRUE;
|
||||||
|
@ -4548,6 +4548,14 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeInt)
|
||||||
{
|
{
|
||||||
UCHAR IntNum;
|
UCHAR IntNum;
|
||||||
|
|
||||||
|
/* Check for V86 mode */
|
||||||
|
if (State->Flags.Vm && (State->Flags.Iopl != 3))
|
||||||
|
{
|
||||||
|
/* Call the V86 monitor */
|
||||||
|
Fast486Exception(State, FAST486_EXCEPTION_GP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (Opcode)
|
switch (Opcode)
|
||||||
{
|
{
|
||||||
case 0xCC: // INT 3
|
case 0xCC: // INT 3
|
||||||
|
|
Loading…
Reference in a new issue