VirtualBox

Changeset 13037 in vbox for trunk


Ignore:
Timestamp:
Oct 7, 2008 11:10:32 AM (16 years ago)
Author:
vboxsync
Message:

EPT updates

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp

    r13025 r13037  
    10071007        /* Note: protected mode & paging are always enabled; we use them for emulating real and protected mode without paging too. */
    10081008        val |= X86_CR0_PE | X86_CR0_PG;
    1009         if (!pVM->hwaccm.s.fNestedPaging)
     1009        if (pVM->hwaccm.s.fNestedPaging)
     1010        {
     1011            if (!(pCtx->cr0 & X86_CR0_PG))
     1012            {
     1013                /* Reenable cr3 read/write monitoring as our identity mapped page table is active. */
     1014                pVM->hwaccm.s.vmx.proc_ctls |=   VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR3_LOAD_EXIT
     1015                                               | VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR3_STORE_EXIT;
     1016            }
     1017            else
     1018            {
     1019                /* Disable cr3 read/write monitoring as we don't need it for EPT. */
     1020                pVM->hwaccm.s.vmx.proc_ctls &=  ~(  VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR3_LOAD_EXIT
     1021                                                  | VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR3_STORE_EXIT);
     1022            }
     1023            rc = VMXWriteVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS, pVM->hwaccm.s.vmx.proc_ctls);
     1024            AssertRC(rc);
     1025        }
     1026        else
    10101027        {
    10111028            /* Note: We must also set this as we rely on protecting various pages for which supervisor writes must be caught. */
     
    23532370                break;
    23542371            case 3:
    2355                 Assert(!pVM->hwaccm.s.fNestedPaging);
     2372                Assert(!pVM->hwaccm.s.fNestedPaging || !(pCtx->cr0 & X86_CR0_PG));
    23562373                pVM->hwaccm.s.fContextUseFlags |= HWACCM_CHANGED_GUEST_CR3;
    23572374                break;
     
    23812398            STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitCRxRead);
    23822399
    2383             Assert(!pVM->hwaccm.s.fNestedPaging || VMX_EXIT_QUALIFICATION_CRX_REGISTER(exitQualification) != USE_REG_CR3);
     2400            Assert(!pVM->hwaccm.s.fNestedPaging || !(pCtx->cr0 & X86_CR0_PG) || VMX_EXIT_QUALIFICATION_CRX_REGISTER(exitQualification) != USE_REG_CR3);
    23842401
    23852402            /* CR8 reads only cause an exit when the TPR shadow feature isn't present. */
  • trunk/src/VBox/VMM/VMMR0/PGMR0.cpp

    r13035 r13037  
    4444#undef PGM_BTH_NAME
    4545
     46#define PGM_BTH_NAME(name)          PGM_BTH_NAME_EPT_PROT(name)
     47#include "PGMR0Bth.h"
     48#undef PGM_BTH_NAME
     49
    4650__END_DECLS
    4751
     
    8286    STAM_STATS({ pVM->pgm.s.CTXSUFF(pStatTrap0eAttribution) = NULL; } );
    8387
    84     /* AMD uses the host's paging mode; Intel's version is on the todo list */
    85     AssertMsg(enmShwPagingMode == PGMMODE_32_BIT || enmShwPagingMode == PGMMODE_PAE || enmShwPagingMode == PGMMODE_PAE_NX || enmShwPagingMode == PGMMODE_AMD64 || enmShwPagingMode == PGMMODE_AMD64_NX, ("enmShwPagingMode=%d\n", enmShwPagingMode));
     88    /* AMD uses the host's paging mode; Intel has a single mode (EPT). */
     89    AssertMsg(enmShwPagingMode == PGMMODE_32_BIT || enmShwPagingMode == PGMMODE_PAE || enmShwPagingMode == PGMMODE_PAE_NX || enmShwPagingMode == PGMMODE_AMD64 || enmShwPagingMode == PGMMODE_AMD64_NX || enmShwPagingMode == PGMMODE_EPT, ("enmShwPagingMode=%d\n", enmShwPagingMode));
    8690
    8791#ifdef VBOX_WITH_STATISTICS
     
    144148        rc = PGM_BTH_NAME_AMD64_PROT(Trap0eHandler)(pVM, uErr, pRegFrame, pvFault);
    145149        break;
     150    case PGMMODE_EPT:
     151        rc = PGM_BTH_NAME_EPT_PROT(Trap0eHandler)(pVM, uErr, pRegFrame, pvFault);
     152        break;
    146153    default:
    147154        AssertFailed();
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