Changeset 8965 in vbox for trunk/src/VBox/VMM
- Timestamp:
- May 20, 2008 3:41:55 PM (17 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PGMAll.cpp
r8533 r8965 277 277 } 278 278 279 280 279 /** 281 280 * Prefetch a page -
trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp
r8952 r8965 266 266 pVMCB->ctrl.u16InterceptWrCRx = RT_BIT(0) | RT_BIT(3) | RT_BIT(4) | RT_BIT(8); 267 267 else 268 pVMCB->ctrl.u16InterceptWrCRx = RT_BIT(0) | RT_BIT( 8);268 pVMCB->ctrl.u16InterceptWrCRx = RT_BIT(0) | RT_BIT(4) | RT_BIT(8); 269 269 270 270 /* Intercept all DRx reads and writes. */ … … 727 727 unsigned cResume = 0; 728 728 729 STAM_PROFILE_ADV_START(&pVM->hwaccm.s.StatEntry, x); 730 729 731 Assert(!pVM->hwaccm.s.svm.fNestedPaging); 730 731 STAM_PROFILE_ADV_START(&pVM->hwaccm.s.StatEntry, x);732 733 732 AssertReturn(pCpu->fSVMConfigured, VERR_EM_INTERNAL_ERROR); 734 733 … … 1279 1278 1280 1279 case SVM_EXIT_NPF: 1280 { 1281 1281 /* EXITINFO1 contains fault errorcode; EXITINFO2 contains the guest physical address causing the fault. */ 1282 uint32_t errCode = pVMCB->ctrl.u64ExitInfo1; /* EXITINFO1 = error code */ 1283 RTGCPHYS uFaultAddress = pVMCB->ctrl.u64ExitInfo2; /* EXITINFO2 = fault address */ 1284 1282 1285 Assert(pVM->hwaccm.s.svm.fNestedPaging); 1286 1287 Log2(("Page fault at %VGp cr2=%VGv error code %x\n", pCtx->eip, uFaultAddress, errCode)); 1288 /* Exit qualification contains the linear address of the page fault. */ 1289 TRPMAssertTrap(pVM, X86_XCPT_PF, TRPM_TRAP); 1290 TRPMSetErrorCode(pVM, errCode); 1291 TRPMSetFaultAddress(pVM, uFaultAddress); 1292 1293 /* Handle the pagefault trap for the nested shadow table. */ 1294 rc = PGMR0Trap0eHandlerNestedPaging(pVM, PGMGetShadowMode(pVM), errCode, CPUMCTX2CORE(pCtx), uFaultAddress); 1295 Log2(("PGMR0Trap0eHandlerNestedPaging %VGv returned %Vrc\n", pCtx->eip, rc)); 1296 if (rc == VINF_SUCCESS) 1297 { /* We've successfully synced our shadow pages, so let's just continue execution. */ 1298 Log2(("Shadow page fault at %VGv cr2=%VGp error code %x\n", pCtx->eip, uFaultAddress, errCode)); 1299 STAM_COUNTER_INC(&pVM->hwaccm.s.StatExitShadowPF); 1300 1301 TRPMResetTrap(pVM); 1302 1303 STAM_PROFILE_ADV_STOP(&pVM->hwaccm.s.StatExit, x); 1304 goto ResumeExecution; 1305 } 1306 1307 #ifdef VBOX_STRICT 1308 if (rc != VINF_EM_RAW_EMULATE_INSTR) 1309 LogFlow(("PGMTrap0eHandlerNestedPaging failed with %d\n", rc)); 1310 #endif 1311 /* Need to go back to the recompiler to emulate the instruction. */ 1312 TRPMResetTrap(pVM); 1283 1313 break; 1314 } 1284 1315 1285 1316 case SVM_EXIT_VINTR: … … 1383 1414 break; 1384 1415 case 4: 1385 Assert(!pVM->hwaccm.s.svm.fNestedPaging);1386 1416 pVM->hwaccm.s.fContextUseFlags |= HWACCM_CHANGED_GUEST_CR4; 1387 1417 break; -
trunk/src/VBox/VMM/VMMR0/PGMR0.cpp
r8155 r8965 30 30 #include <iprt/assert.h> 31 31 32 __BEGIN_DECLS 33 #define PGM_BTH_NAME(name) PGM_BTH_NAME_32BIT_PROT(name) 34 #include "PGMR0Bth.h" 35 36 #define PGM_BTH_NAME(name) PGM_BTH_NAME_PAE_PROT(name) 37 #include "PGMR0Bth.h" 38 /* 39 #define PGM_BTH_NAME(name) PGM_BTH_NAME_AMD64_PROT(name) 40 #include "PGMR0Bth.h" 41 */ 42 __END_DECLS 32 43 33 44 … … 45 56 PGMR0DECL(int) PGMR0PhysAllocateHandyPages(PVM pVM) 46 57 { 47 48 58 return VERR_NOT_IMPLEMENTED; 49 59 } 50 60 51 61 62 /** 63 * #PF Handler for nested paging. 64 * 65 * @returns VBox status code (appropriate for trap handling and GC return). 66 * @param pVM VM Handle. 67 * @param enmShwPagingMode Paging mode for the nested page tables 68 * @param uErr The trap error code. 69 * @param pRegFrame Trap register frame. 70 * @param pvFault The fault address. 71 */ 72 PGMR0DECL(int) PGMR0Trap0eHandlerNestedPaging(PVM pVM, PGMMODE enmShwPagingMode, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPHYS pvFault) 73 { 74 int rc; 75 76 LogFlow(("PGMTrap0eHandler: uErr=%#x pvFault=%VGp eip=%VGv\n", uErr, pvFault, pRegFrame->eip)); 77 STAM_PROFILE_START(&pVM->pgm.s.StatGCTrap0e, a); 78 STAM_STATS({ pVM->pgm.s.CTXSUFF(pStatTrap0eAttribution) = NULL; } ); 79 80 /* AMD uses the host's paging mode; Intel's version is on the todo list */ 81 Assert(enmShwPagingMode == PGMMODE_32_BIT || enmShwPagingMode == PGMMODE_PAE); // || enmShwPagingMode == PGMMODE_AMD64); 82 83 #ifdef VBOX_WITH_STATISTICS 84 /* 85 * Error code stats. 86 */ 87 if (uErr & X86_TRAP_PF_US) 88 { 89 if (!(uErr & X86_TRAP_PF_P)) 90 { 91 if (uErr & X86_TRAP_PF_RW) 92 STAM_COUNTER_INC(&pVM->pgm.s.StatGCTrap0eUSNotPresentWrite); 93 else 94 STAM_COUNTER_INC(&pVM->pgm.s.StatGCTrap0eUSNotPresentRead); 95 } 96 else if (uErr & X86_TRAP_PF_RW) 97 STAM_COUNTER_INC(&pVM->pgm.s.StatGCTrap0eUSWrite); 98 else if (uErr & X86_TRAP_PF_RSVD) 99 STAM_COUNTER_INC(&pVM->pgm.s.StatGCTrap0eUSReserved); 100 else if (uErr & X86_TRAP_PF_ID) 101 STAM_COUNTER_INC(&pVM->pgm.s.StatGCTrap0eUSNXE); 102 else 103 STAM_COUNTER_INC(&pVM->pgm.s.StatGCTrap0eUSRead); 104 } 105 else 106 { /* Supervisor */ 107 if (!(uErr & X86_TRAP_PF_P)) 108 { 109 if (uErr & X86_TRAP_PF_RW) 110 STAM_COUNTER_INC(&pVM->pgm.s.StatGCTrap0eSVNotPresentWrite); 111 else 112 STAM_COUNTER_INC(&pVM->pgm.s.StatGCTrap0eSVNotPresentRead); 113 } 114 else if (uErr & X86_TRAP_PF_RW) 115 STAM_COUNTER_INC(&pVM->pgm.s.StatGCTrap0eSVWrite); 116 else if (uErr & X86_TRAP_PF_ID) 117 STAM_COUNTER_INC(&pVM->pgm.s.StatGCTrap0eSNXE); 118 else if (uErr & X86_TRAP_PF_RSVD) 119 STAM_COUNTER_INC(&pVM->pgm.s.StatGCTrap0eSVReserved); 120 } 121 #endif 122 123 /* 124 * Call the worker. 125 */ 126 switch(enmShwPagingMode) 127 { 128 case PGMMODE_32_BIT: 129 rc = PGM_BTH_NAME_32BIT_PROT(Trap0eHandler)(pVM, uErr, pRegFrame, pvFault); 130 break; 131 case PGMMODE_PAE: 132 rc = PGM_BTH_NAME_PAE_PROT(Trap0eHandler)(pVM, uErr, pRegFrame, pvFault); 133 break; 134 /* 135 case PGMMODE_AMD64: 136 rc = PGM_BTH_NAME_AMD64_PROT(Trap0eHandler)(pVM, uErr, pRegFrame, pvFault); 137 break; 138 */ 139 } 140 if (rc == VINF_PGM_SYNCPAGE_MODIFIED_PDE) 141 rc = VINF_SUCCESS; 142 STAM_STATS({ if (!pVM->pgm.s.CTXSUFF(pStatTrap0eAttribution)) 143 pVM->pgm.s.CTXSUFF(pStatTrap0eAttribution) = &pVM->pgm.s.StatTrap0eMisc; }); 144 STAM_PROFILE_STOP_EX(&pVM->pgm.s.StatGCTrap0e, pVM->pgm.s.CTXSUFF(pStatTrap0eAttribution), a); 145 return rc; 146 }
Note:
See TracChangeset
for help on using the changeset viewer.