VirtualBox

Changeset 13174 in vbox


Ignore:
Timestamp:
Oct 10, 2008 1:29:27 PM (16 years ago)
Author:
vboxsync
Message:

Cleaned up a bit

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/cpum.h

    r13005 r13174  
    744744
    745745/**
     746 * Tests if the guest is running in paged protected or not.
     747 *
     748 * @returns true if in paged protected mode, otherwise false.
     749 * @param   pVM     The VM handle.
     750 */
     751DECLINLINE(bool) CPUMIsGuestInPagedProtectedModeEx(PCPUMCTX pCtx)
     752{
     753    return (pCtx->cr0 & (X86_CR0_PE | X86_CR0_PG)) == (X86_CR0_PE | X86_CR0_PG);
     754}
     755
     756/**
    746757 * Tests if the guest is running in long mode or not.
    747758 *
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp

    r13173 r13174  
    10761076        if (pVM->hwaccm.s.fNestedPaging)
    10771077        {
    1078             if (!(pCtx->cr0 & X86_CR0_PG))
     1078            if (CPUMIsGuestInPagedProtectedModeEx(pCtx))
     1079            {
     1080                /* Disable cr3 read/write monitoring as we don't need it for EPT. */
     1081                pVM->hwaccm.s.vmx.proc_ctls &=  ~(  VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR3_LOAD_EXIT
     1082                                                  | VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR3_STORE_EXIT);
     1083            }
     1084            else
    10791085            {
    10801086                /* Reenable cr3 read/write monitoring as our identity mapped page table is active. */
    10811087                pVM->hwaccm.s.vmx.proc_ctls |=   VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR3_LOAD_EXIT
    10821088                                               | VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR3_STORE_EXIT;
    1083             }
    1084             else
    1085             {
    1086                 /* Disable cr3 read/write monitoring as we don't need it for EPT. */
    1087                 pVM->hwaccm.s.vmx.proc_ctls &=  ~(  VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR3_LOAD_EXIT
    1088                                                   | VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR3_STORE_EXIT);
    10891089            }
    10901090            rc = VMXWriteVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS, pVM->hwaccm.s.vmx.proc_ctls);
     
    12071207            AssertRC(rc);
    12081208
    1209             if (!(pCtx->cr0 & X86_CR0_PG))
     1209            if (!CPUMIsGuestInPagedProtectedModeEx(pCtx))
    12101210            {
    12111211                RTGCPHYS GCPhys;
     
    24462446                break;
    24472447            case 3:
    2448                 Assert(!pVM->hwaccm.s.fNestedPaging || !(pCtx->cr0 & X86_CR0_PG));
     2448                Assert(!pVM->hwaccm.s.fNestedPaging || !CPUMIsGuestInPagedProtectedModeEx(pCtx));
    24492449                pVM->hwaccm.s.fContextUseFlags |= HWACCM_CHANGED_GUEST_CR3;
    24502450                break;
     
    24742474            STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitCRxRead);
    24752475
    2476             Assert(!pVM->hwaccm.s.fNestedPaging || !(pCtx->cr0 & X86_CR0_PG) || VMX_EXIT_QUALIFICATION_CRX_REGISTER(exitQualification) != USE_REG_CR3);
     2476            Assert(!pVM->hwaccm.s.fNestedPaging || !CPUMIsGuestInPagedProtectedModeEx(pCtx) || VMX_EXIT_QUALIFICATION_CRX_REGISTER(exitQualification) != USE_REG_CR3);
    24772477
    24782478            /* CR8 reads only cause an exit when the TPR shadow feature isn't present. */
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