VirtualBox

Ignore:
Timestamp:
Jul 26, 2019 5:06:38 PM (5 years ago)
Author:
vboxsync
Message:

VMM: Kicking out raw-mode (work in progress) - EM. bugref:9517

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/EMAll.cpp

    r80007 r80016  
    10061006{
    10071007    PVMCPU      pVCpu    = (PVMCPU)pDis->pvUser;
    1008 #if defined(VBOX_WITH_RAW_MODE) && (defined(IN_RC) || defined(IN_RING3))
    1009     PVM         pVM      = pVCpu->CTX_SUFF(pVM);
    1010 #endif
    10111008    RTUINTPTR   uSrcAddr = pDis->uInstrAddr + offInstr;
    1012     int         rc;
    10131009
    10141010    /*
     
    10211017        cbToRead = cbMinRead;
    10221018
    1023 #if defined(VBOX_WITH_RAW_MODE) && (defined(IN_RC) || defined(IN_RING3))
    1024     /*
    1025      * We might be called upon to interpret an instruction in a patch.
    1026      */
    1027     if (PATMIsPatchGCAddr(pVM, uSrcAddr))
     1019    int rc = PGMPhysSimpleReadGCPtr(pVCpu, &pDis->abInstr[offInstr], uSrcAddr, cbToRead);
     1020    if (RT_FAILURE(rc))
    10281021    {
    1029 # ifdef IN_RC
    1030         memcpy(&pDis->abInstr[offInstr], (void *)(uintptr_t)uSrcAddr, cbToRead);
    1031 # else
    1032         memcpy(&pDis->abInstr[offInstr], PATMR3GCPtrToHCPtr(pVM, uSrcAddr), cbToRead);
    1033 # endif
    1034         rc = VINF_SUCCESS;
    1035     }
    1036     else
    1037 #endif
    1038     {
    1039 # ifdef IN_RC
    1040         /*
    1041          * Try access it thru the shadow page tables first. Fall back on the
    1042          * slower PGM method if it fails because the TLB or page table was
    1043          * modified recently.
    1044          */
    1045         rc = MMGCRamRead(pVCpu->pVMRC, &pDis->abInstr[offInstr], (void *)(uintptr_t)uSrcAddr, cbToRead);
    1046         if (rc == VERR_ACCESS_DENIED && cbToRead > cbMinRead)
     1022        if (cbToRead > cbMinRead)
    10471023        {
    10481024            cbToRead = cbMinRead;
    1049             rc = MMGCRamRead(pVCpu->pVMRC, &pDis->abInstr[offInstr], (void *)(uintptr_t)uSrcAddr, cbToRead);
     1025            rc = PGMPhysSimpleReadGCPtr(pVCpu, &pDis->abInstr[offInstr], uSrcAddr, cbToRead);
    10501026        }
    1051         if (rc == VERR_ACCESS_DENIED)
     1027        if (RT_FAILURE(rc))
     1028        {
     1029#ifndef IN_RC
     1030            /*
     1031             * If we fail to find the page via the guest's page tables
     1032             * we invalidate the page in the host TLB (pertaining to
     1033             * the guest in the NestedPaging case). See @bugref{6043}.
     1034             */
     1035            if (rc == VERR_PAGE_TABLE_NOT_PRESENT || rc == VERR_PAGE_NOT_PRESENT)
     1036            {
     1037                HMInvalidatePage(pVCpu, uSrcAddr);
     1038                if (((uSrcAddr + cbToRead - 1) >> PAGE_SHIFT) !=  (uSrcAddr >> PAGE_SHIFT))
     1039                    HMInvalidatePage(pVCpu, uSrcAddr + cbToRead - 1);
     1040            }
    10521041#endif
    1053         {
    1054             rc = PGMPhysSimpleReadGCPtr(pVCpu, &pDis->abInstr[offInstr], uSrcAddr, cbToRead);
    1055             if (RT_FAILURE(rc))
    1056             {
    1057                 if (cbToRead > cbMinRead)
    1058                 {
    1059                     cbToRead = cbMinRead;
    1060                     rc = PGMPhysSimpleReadGCPtr(pVCpu, &pDis->abInstr[offInstr], uSrcAddr, cbToRead);
    1061                 }
    1062                 if (RT_FAILURE(rc))
    1063                 {
    1064 #ifndef IN_RC
    1065                     /*
    1066                      * If we fail to find the page via the guest's page tables
    1067                      * we invalidate the page in the host TLB (pertaining to
    1068                      * the guest in the NestedPaging case). See @bugref{6043}.
    1069                      */
    1070                     if (rc == VERR_PAGE_TABLE_NOT_PRESENT || rc == VERR_PAGE_NOT_PRESENT)
    1071                     {
    1072                         HMInvalidatePage(pVCpu, uSrcAddr);
    1073                         if (((uSrcAddr + cbToRead - 1) >> PAGE_SHIFT) !=  (uSrcAddr >> PAGE_SHIFT))
    1074                             HMInvalidatePage(pVCpu, uSrcAddr + cbToRead - 1);
    1075                     }
    1076 #endif
    1077                 }
    1078             }
    10791042        }
    10801043    }
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