VirtualBox

Changeset 12732 in vbox


Ignore:
Timestamp:
Sep 25, 2008 1:53:39 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
37055
Message:

#GP handler should emulation io instructions in real mode. (VT-x)

Location:
trunk/src/VBox/VMM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/HWACCM.cpp

    r12707 r12732  
    529529
    530530            /* The I/O bitmap starts right after the virtual interrupt redirection bitmap. Outside the TSS on purpose; the CPU will not check it
    531             * for I/O operations. */
     531             * for I/O operations. (but fault (#GP) on all IO instructions instead) */
    532532            ASMMemZero32(pVM->hwaccm.s.vmx.pRealModeTSS, sizeof(*pVM->hwaccm.s.vmx.pRealModeTSS));
    533533            pVM->hwaccm.s.vmx.pRealModeTSS->offIoBitmap = sizeof(*pVM->hwaccm.s.vmx.pRealModeTSS);
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp

    r12730 r12732  
    10971097#endif
    10981098
     1099    /* Intercept #GP faults in real mode to handle IO instructions. */
     1100    if (CPUMIsGuestInRealModeEx(pCtx))
     1101        pVM->hwaccm.s.vmx.u32TrapMask |= RT_BIT(X86_XCPT_GP);
     1102    else
     1103        pVM->hwaccm.s.vmx.u32TrapMask &= ~RT_BIT(X86_XCPT_GP);
     1104
     1105    rc = VMXWriteVMCS(VMX_VMCS_CTRL_EXCEPTION_BITMAP, pVM->hwaccm.s.vmx.u32TrapMask);
     1106    AssertRC(rc);   
     1107
    10991108    /* Done. */
    11001109    pVM->hwaccm.s.fContextUseFlags &= ~HWACCM_CHANGED_ALL_GUEST;
     
    18191828            }
    18201829
     1830            case X86_XCPT_GP:   /* General protection failure exception.*/
     1831            {
     1832                STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitGuestGP);
     1833#ifdef VBOX_STRICT
     1834                Log(("Trap %x at %VGv error code %x\n", vector, pCtx->rip, errCode));
     1835                rc = VMXR0InjectEvent(pVM, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode);
     1836                AssertRC(rc);
     1837                STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1838                goto ResumeExecution;
     1839#else
     1840                Assert(CPUMIsGuestInRealModeEx(pCtx));
     1841
     1842                LogFlow(("Real mode X86_XCPT_GP instruction emulation at %VGv\n", pCtx->rip));
     1843                rc = EMInterpretInstruction(pVM, CPUMCTX2CORE(pCtx), 0, &cbSize);
     1844                if (rc == VINF_SUCCESS)
     1845                {
     1846                    /* EIP has been updated already. */
     1847
     1848                    /* Only resume if successful. */
     1849                    STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x);
     1850                    goto ResumeExecution;
     1851                }
     1852                AssertMsg(rc == VERR_EM_INTERPRETER);
     1853                break;
     1854#endif
     1855            }
     1856
    18211857#ifdef VBOX_STRICT
    18221858            case X86_XCPT_DE:   /* Divide error. */
    1823             case X86_XCPT_GP:   /* General protection failure exception.*/
    18241859            case X86_XCPT_UD:   /* Unknown opcode exception. */
    18251860            case X86_XCPT_SS:   /* Stack segment exception. */
     
    18391874                case X86_XCPT_NP:
    18401875                    STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitGuestNP);
    1841                     break;
    1842                 case X86_XCPT_GP:
    1843                     STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitGuestGP);
    18441876                    break;
    18451877                }
Note: See TracChangeset for help on using the changeset viewer.

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