- Timestamp:
- Sep 4, 2009 9:56:20 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp
r22767 r22771 896 896 } 897 897 898 /** 899 * Flushes the page being accessed. 900 * 901 * @returns VBox status code suitable for scheduling. 902 * @param pVM The VM handle. 903 * @param pVCpu The VMCPU handle. 904 * @param pPool The pool. 905 * @param pPage The pool page (head). 906 * @param pDis The disassembly of the write instruction. 907 * @param pRegFrame The trap register frame. 908 * @param GCPhysFault The fault address as guest physical address. 909 * @param pvFault The fault address. 910 */ 911 static int pgmPoolAccessHandlerFlush(PVM pVM, PVMCPU pVCpu, PPGMPOOL pPool, PPGMPOOLPAGE pPage, PDISCPUSTATE pDis, 912 PCPUMCTXCORE pRegFrame, RTGCPHYS GCPhysFault, RTGCPTR pvFault) 913 { 914 #ifdef IN_RING0 915 int rc = pgmPoolMonitorChainFlush(pPool, pPage); 916 #else 917 /* 918 * First, do the flushing. 919 */ 920 int rc = pgmPoolMonitorChainFlush(pPool, pPage); 921 922 /* 923 * Emulate the instruction (xp/w2k problem, requires pc/cr2/sp detection). Must do this in raw mode (!); XP boot will fail otherwise 924 */ 925 uint32_t cbWritten; 926 int rc2 = EMInterpretInstructionCPU(pVM, pVCpu, pDis, pRegFrame, pvFault, &cbWritten); 927 if (RT_SUCCESS(rc2)) 928 pRegFrame->rip += pDis->opsize; 929 else if (rc2 == VERR_EM_INTERPRETER) 930 { 931 #ifdef IN_RC 932 if (PATMIsPatchGCAddr(pVM, (RTRCPTR)pRegFrame->eip)) 933 { 934 LogFlow(("pgmPoolAccessHandlerPTWorker: Interpretation failed for patch code %04x:%RGv, ignoring.\n", 935 pRegFrame->cs, (RTGCPTR)pRegFrame->eip)); 936 rc = VINF_SUCCESS; 937 STAM_COUNTER_INC(&pPool->StatMonitorRZIntrFailPatch2); 938 } 939 else 940 #endif 941 { 942 rc = VINF_EM_RAW_EMULATE_INSTR; 943 STAM_COUNTER_INC(&pPool->CTX_MID_Z(StatMonitor,EmulateInstr)); 944 } 945 } 946 else 947 rc = rc2; 948 949 /* See use in pgmPoolAccessHandlerSimple(). */ 950 PGM_INVL_VCPU_TLBS(pVCpu); 951 #endif 952 LogFlow(("pgmPoolAccessHandlerPT: returns %Rrc (flushed)\n", rc)); 953 return rc; 954 } 898 955 899 956 /** … … 1324 1381 #endif /* PGMPOOL_WITH_OPTIMIZED_DIRTY_PT */ 1325 1382 1383 flushPage: 1326 1384 /* 1327 1385 * Not worth it, so flush it. 1328 */ 1329 flushPage: 1330 rc = pgmPoolMonitorChainFlush(pPool, pPage); 1386 * 1387 * If we considered it to be reused, don't go back to ring-3 1388 * to emulate failed instructions since we usually cannot 1389 * interpret then. This may be a bit risky, in which case 1390 * the reuse detection must be fixed. 1391 */ 1392 rc = pgmPoolAccessHandlerFlush(pVM, pVCpu, pPool, pPage, pDis, pRegFrame, GCPhysFault, pvFault); 1393 if (rc == VINF_EM_RAW_EMULATE_INSTR && fReused) 1394 rc = VINF_SUCCESS; 1331 1395 STAM_PROFILE_STOP_EX(&pVM->pgm.s.CTX_SUFF(pPool)->CTX_SUFF_Z(StatMonitor), &pPool->CTX_MID_Z(StatMonitor,FlushPage), a); 1332 1396 pgmUnlock(pVM);
Note:
See TracChangeset
for help on using the changeset viewer.