Changeset 56013 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- May 21, 2015 5:04:14 PM (10 years ago)
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/CSAMAll.cpp
r55937 r56013 72 72 * @param pvUser User argument. 73 73 */ 74 PGM_ALL_CB2_DECL(int) csamCodePageWriteHandler(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf, 75 PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser) 74 PGM_ALL_CB2_DECL(VBOXSTRICTRC) 75 csamCodePageWriteHandler(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf, 76 PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser) 76 77 { 77 78 RTGCPTR const GCPtrMonitored = (uintptr_t)pvUser | (GCPtr & PAGE_OFFSET_MASK); -
trunk/src/VBox/VMM/VMMAll/PATMAll.cpp
r55937 r56013 58 58 * @param pvUser The address of the guest page we're monitoring. 59 59 */ 60 PGM_ALL_CB2_DECL( int) patmVirtPageHandler(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf,61 PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser)60 PGM_ALL_CB2_DECL(VBOXSTRICTRC) patmVirtPageHandler(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf, 61 PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser) 62 62 { 63 63 Assert(enmAccessType == PGMACCESSTYPE_WRITE); NOREF(enmAccessType); -
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r55988 r56013 719 719 && uErr & X86_TRAP_PF_RW) 720 720 { 721 VBOXSTRICTRC rcStrict; 721 722 # ifdef IN_RC 722 723 STAM_PROFILE_START(&pCur->Stat, h); … … 724 725 void *pvUser = pCur->CTX_SUFF(pvUser); 725 726 pgmUnlock(pVM); 726 rc = pCurType->CTX_SUFF(pfnPfHandler)(pVM, pVCpu, uErr, pRegFrame, pvFault, pCur->Core.Key,727 pvFault - pCur->Core.Key, pvUser);727 rcStrict = pCurType->CTX_SUFF(pfnPfHandler)(pVM, pVCpu, uErr, pRegFrame, pvFault, pCur->Core.Key, 728 pvFault - pCur->Core.Key, pvUser); 728 729 pgmLock(pVM); 729 730 STAM_PROFILE_STOP(&pCur->Stat, h); 730 731 # else 731 732 AssertFailed(); 732 rc = VINF_EM_RAW_EMULATE_INSTR; /* can't happen with VMX */733 rcStrict = VINF_EM_RAW_EMULATE_INSTR; /* can't happen with VMX */ 733 734 # endif 734 735 STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_SUFF(pStats)->StatRZTrap0eHandlersMapping); 735 736 STAM_STATS({ pVCpu->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVCpu->pgm.s.CTX_SUFF(pStats)->StatRZTrap0eTime2Mapping; }); 736 return rc;737 return VBOXSTRICTRC_TODO(rcStrict); 737 738 } 738 739 … … 816 817 || pCurType->enmKind != PGMVIRTHANDLERKIND_WRITE ) ) 817 818 { 819 VBOXSTRICTRC rcStrict; 818 820 # ifdef IN_RC 819 821 STAM_PROFILE_START(&pCur->Stat, h); 820 822 void *pvUser = pCur->CTX_SUFF(pvUser); 821 823 pgmUnlock(pVM); 822 rc = pCurType->CTX_SUFF(pfnPfHandler)(pVM, pVCpu, uErr, pRegFrame, pvFault, pCur->Core.Key,823 pvFault - pCur->Core.Key, pvUser);824 rcStrict = pCurType->CTX_SUFF(pfnPfHandler)(pVM, pVCpu, uErr, pRegFrame, pvFault, pCur->Core.Key, 825 pvFault - pCur->Core.Key, pvUser); 824 826 pgmLock(pVM); 825 827 STAM_PROFILE_STOP(&pCur->Stat, h); 826 828 # else 827 rc = VINF_EM_RAW_EMULATE_INSTR; /** @todo for VMX */829 rcStrict = VINF_EM_RAW_EMULATE_INSTR; /** @todo for VMX */ 828 830 # endif 829 831 STAM_STATS({ pVCpu->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVCpu->pgm.s.CTX_SUFF(pStats)->StatRZTrap0eTime2HndVirt; }); 830 return rc;832 return VBOXSTRICTRC_TODO(rcStrict); 831 833 } 832 834 } -
trunk/src/VBox/VMM/VMMAll/SELMAll.cpp
r55899 r56013 47 47 #endif 48 48 49 50 #ifndef IN_RING0 51 52 # ifdef SELM_TRACK_GUEST_GDT_CHANGES 53 /** 54 * @callback_method_impl{FNPGMVIRTHANDLER} 55 */ 56 PGM_ALL_CB2_DECL(VBOXSTRICTRC) 57 selmGuestGDTWriteHandler(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf, 58 PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser) 59 { 60 Assert(enmAccessType == PGMACCESSTYPE_WRITE); NOREF(enmAccessType); 61 Log(("selmGuestGDTWriteHandler: write to %RGv size %d\n", GCPtr, cbBuf)); NOREF(GCPtr); NOREF(cbBuf); 62 NOREF(pvPtr); NOREF(pvBuf); NOREF(enmOrigin); NOREF(pvUser); 63 64 # ifdef IN_RING3 65 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_GDT); 66 return VINF_PGM_HANDLER_DO_DEFAULT; 67 68 # else /* IN_RC: */ 69 /* 70 * Execute the write, doing necessary pre and post shadow GDT checks. 71 */ 72 PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu); 73 uint32_t offGuestGdt = pCtx->gdtr.pGdt - GCPtr; 74 selmRCGuestGdtPreWriteCheck(pVM, pVCpu, offGuestGdt, cbBuf, pCtx); 75 memcpy(pvBuf, pvPtr, cbBuf); 76 VBOXSTRICTRC rcStrict = selmRCGuestGdtPostWriteCheck(pVM, pVCpu, offGuestGdt, cbBuf, pCtx); 77 if (!VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_SELM_SYNC_GDT)) 78 STAM_COUNTER_INC(&pVM->selm.s.StatRCWriteGuestGDTHandled); 79 else 80 STAM_COUNTER_INC(&pVM->selm.s.StatRCWriteGuestGDTUnhandled); 81 return rcStrict; 82 # endif 83 } 84 # endif 85 86 87 # ifdef SELM_TRACK_GUEST_LDT_CHANGES 88 /** 89 * @callback_method_impl{FNPGMVIRTHANDLER} 90 */ 91 PGM_ALL_CB2_DECL(VBOXSTRICTRC) 92 selmGuestLDTWriteHandler(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf, 93 PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser) 94 { 95 Assert(enmAccessType == PGMACCESSTYPE_WRITE); NOREF(enmAccessType); 96 Log(("selmGuestLDTWriteHandler: write to %RGv size %d\n", GCPtr, cbBuf)); NOREF(GCPtr); NOREF(cbBuf); 97 NOREF(pvPtr); NOREF(pvBuf); NOREF(enmOrigin); NOREF(pvUser); 98 99 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_LDT); 100 # ifdef IN_RING3 101 return VINF_PGM_HANDLER_DO_DEFAULT; 102 # else 103 STAM_COUNTER_INC(&pVM->selm.s.StatRCWriteGuestLDT); 104 return VINF_EM_RAW_EMULATE_INSTR_LDT_FAULT; 105 # endif 106 } 107 # endif 108 109 110 # ifdef SELM_TRACK_GUEST_TSS_CHANGES 111 /** 112 * @callback_method_impl{FNPGMVIRTHANDLER} 113 */ 114 PGM_ALL_CB2_DECL(VBOXSTRICTRC) 115 selmGuestTSSWriteHandler(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf, 116 PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser) 117 { 118 Assert(enmAccessType == PGMACCESSTYPE_WRITE); NOREF(enmAccessType); 119 Log(("selmGuestTSSWriteHandler: write %.*Rhxs to %RGv size %d\n", RT_MIN(8, cbBuf), pvBuf, GCPtr, cbBuf)); 120 NOREF(pvBuf); NOREF(GCPtr); NOREF(cbBuf); NOREF(enmOrigin); NOREF(pvUser); NOREF(pvPtr); 121 122 # ifdef IN_RING3 123 /** @todo This can be optimized by checking for the ESP0 offset and tracking TR 124 * reloads in REM (setting VM_FF_SELM_SYNC_TSS if TR is reloaded). We 125 * should probably also deregister the virtual handler if TR.base/size 126 * changes while we're in REM. May also share 127 * selmRCGuestTssPostWriteCheck code. */ 128 VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_TSS); 129 return VINF_PGM_HANDLER_DO_DEFAULT; 130 131 # else /* IN_RC */ 132 /* 133 * Do the write and check if anything relevant changed. 134 */ 135 Assert(pVM->selm.s.GCPtrGuestTss != (uintptr_t)RTRCPTR_MAX); 136 memcpy(pvPtr, pvBuf, cbBuf); 137 return selmRCGuestTssPostWriteCheck(pVM, pVCpu, GCPtr - pVM->selm.s.GCPtrGuestTss, cbBuf); 138 # endif 139 } 140 # endif 141 142 #endif /* IN_RING0 */ 49 143 50 144 -
trunk/src/VBox/VMM/VMMAll/TRPMAll.cpp
r55001 r56013 41 41 #include "internal/pgm.h" 42 42 43 44 45 #if defined(TRPM_TRACK_GUEST_IDT_CHANGES) && !defined(IN_RING0) 46 /** 47 * \#PF Handler callback for virtual access handler ranges. 48 * 49 * Important to realize that a physical page in a range can have aliases, and 50 * for ALL and WRITE handlers these will also trigger. 51 * 52 * @returns VINF_SUCCESS if the handler have carried out the operation. 53 * @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation. 54 * @param pVM Pointer to the VM. 55 * @param pVCpu Pointer to the cross context CPU context for the 56 * calling EMT. 57 * @param GCPtr The virtual address the guest is writing to. (not correct if it's an alias!) 58 * @param pvPtr The HC mapping of that address. 59 * @param pvBuf What the guest is reading/writing. 60 * @param cbBuf How much it's reading/writing. 61 * @param enmAccessType The access type. 62 * @param enmOrigin The origin of this call. 63 * @param pvUser User argument. 64 */ 65 PGM_ALL_CB2_DECL(VBOXSTRICTRC) 66 trpmGuestIDTWriteHandler(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf, 67 PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser) 68 { 69 Assert(enmAccessType == PGMACCESSTYPE_WRITE); NOREF(enmAccessType); 70 Log(("trpmGuestIDTWriteHandler: write to %RGv size %d\n", GCPtr, cbBuf)); NOREF(GCPtr); NOREF(cbBuf); 71 NOREF(pvPtr); NOREF(pvUser); NOREF(pvBuf); NOREF(enmOrigin); NOREF(pvUser); 72 Assert(!HMIsEnabled(pVM)); 73 74 /** @todo Check which IDT entry and keep the update cost low in TRPMR3SyncIDT() and CSAMCheckGates(). */ 75 VMCPU_FF_SET(pVCpu, VMCPU_FF_TRPM_SYNC_IDT); 76 # ifdef IN_RC 77 STAM_COUNTER_INC(&pVM->trpm.s.StatRCWriteGuestIDTFault); 78 # endif 79 return VINF_PGM_HANDLER_DO_DEFAULT; 80 } 81 #endif /* TRPM_TRACK_GUEST_IDT_CHANGES && !IN_RING0 */ 43 82 44 83
Note:
See TracChangeset
for help on using the changeset viewer.