VirtualBox

Changeset 2003 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Apr 10, 2007 9:30:52 AM (18 years ago)
Author:
vboxsync
Message:

Emulate monitor in ring 0.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMGC/TRPMGCHandlers.cpp

    r1981 r2003  
    343343    LogFlow(("TRPMGCTrap06Handler %VGv eflags=%x\n", pRegFrame->eip, pRegFrame->eflags.u32));
    344344
    345     if (    (pRegFrame->ss & X86_SEL_RPL) == 1
    346         &&  !pRegFrame->eflags.Bits.u1VM
    347         &&  PATMIsPatchGCAddr(pVM, (RTGCPTR)pRegFrame->eip))
     345    if (CPUMGetGuestCPL(pVM, pRegFrame) == 0)
    348346    {
    349347        /*
     
    364362            return trpmGCExitTrap(pVM, VINF_EM_RAW_EMULATE_INSTR, pRegFrame);
    365363
    366         /** @note monitor causes an #UD exception instead of #GP when not executed in ring 0. */
    367         if (Cpu.pCurInstr->opcode == OP_ILLUD2)
     364        if (    PATMIsPatchGCAddr(pVM, (RTGCPTR)pRegFrame->eip)
     365            &&  Cpu.pCurInstr->opcode == OP_ILLUD2)
    368366        {
    369367            rc = PATMGCHandleIllegalInstrTrap(pVM, pRegFrame);
     
    371369                return trpmGCExitTrap(pVM, rc, pRegFrame);
    372370        }
    373         /* Never generate a raw trap here; it might be a monitor instruction, that requires emulation. */
    374         rc = VINF_EM_RAW_EMULATE_INSTR;
    375     }
    376     else if (pRegFrame->eflags.Bits.u1VM)
     371        else
     372        /** Note: monitor causes an #UD exception instead of #GP when not executed in ring 0. */
     373        if (Cpu.pCurInstr->opcode == OP_MONITOR)
     374        {
     375            uint32_t cbIgnored;
     376            rc = EMInterpretInstructionCPU(pVM, &Cpu, pRegFrame, PC, &cbIgnored);
     377        }
     378        else
     379            /* Never generate a raw trap here; it might be an instruction, that requires emulation. */
     380            rc = VINF_EM_RAW_EMULATE_INSTR;
     381    }
     382    else
     383    if (pRegFrame->eflags.Bits.u1VM)
    377384    {
    378385        rc = TRPMForwardTrap(pVM, pRegFrame, 0x6, 0, TRPM_TRAP_NO_ERRORCODE, TRPM_TRAP);
     
    380387    }
    381388    else
    382         /* Never generate a raw trap here; it might be a monitor instruction, that requires emulation. */
     389        /* Never generate a raw trap here; it might be an instruction, that requires emulation. */
    383390        rc = VINF_EM_RAW_EMULATE_INSTR;
    384391
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette