- Timestamp:
- Jul 12, 2014 12:01:19 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/gim.h
r51797 r52006 200 200 VMMDECL(bool) GIMIsEnabled(PVM pVM); 201 201 VMMDECL(GIMPROVIDERID) GIMGetProvider(PVM pVM); 202 VMMDECL(bool) GIMIsParavirtTscEnabled(PVM pVM); 202 VMM_INT_DECL(bool) GIMIsParavirtTscEnabled(PVM pVM); 203 VMM_INT_DECL(bool) GIMAreHypercallsEnabled(PVMCPU pVCpu); 203 204 VMM_INT_DECL(int) GIMHypercall(PVMCPU pVCpu, PCPUMCTX pCtx); 204 205 VMM_INT_DECL(int) GIMReadMsr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue); -
trunk/src/VBox/VMM/VMMAll/GIMAll.cpp
r51643 r52006 57 57 58 58 /** 59 * Returns whether the guest has configured and enabled calls to the hypervisor. 60 * 61 * @returns true if hypercalls are enabled and usable, false otherwise. 62 * @param pVCpu Pointer to the VMCPU. 63 */ 64 VMM_INT_DECL(bool) GIMAreHypercallsEnabled(PVMCPU pVCpu) 65 { 66 PVM pVM = pVCpu->CTX_SUFF(pVM); 67 if (!GIMIsEnabled(pVM)) 68 return false; 69 70 switch (pVM->gim.s.enmProviderId) 71 { 72 case GIMPROVIDERID_HYPERV: 73 return GIMHvAreHypercallsEnabled(pVCpu); 74 75 default: 76 return false; 77 } 78 } 79 80 81 /** 59 82 * Implements a GIM hypercall with the provider configured for the VM. 60 83 * … … 66 89 { 67 90 PVM pVM = pVCpu->CTX_SUFF(pVM); 68 Assert(GIMIsEnabled(pVM));69 91 VMCPU_ASSERT_EMT(pVCpu); 92 93 if (RT_UNLIKELY(!GIMIsEnabled(pVM))) 94 return VERR_GIM_NOT_ENABLED; 70 95 71 96 switch (pVM->gim.s.enmProviderId) … … 80 105 } 81 106 82 VMMDECL(bool) GIMIsParavirtTscEnabled(PVM pVM) 107 108 /** 109 * Returns whether the guest has configured and setup the use of paravirtualized 110 * TSC. Paravirtualized TSCs are per-VM and the rest of the execution engine 111 * logic relies on that. 112 * 113 * @returns true if enabled and usable, false otherwise. 114 * @param pVM Pointer to the VM. 115 */ 116 VMM_INT_DECL(bool) GIMIsParavirtTscEnabled(PVM pVM) 83 117 { 84 118 if (!pVM->gim.s.fEnabled) -
trunk/src/VBox/VMM/VMMAll/GIMAllHv.cpp
r51980 r52006 44 44 VMM_INT_DECL(int) GIMHvHypercall(PVMCPU pVCpu, PCPUMCTX pCtx) 45 45 { 46 return VINF_SUCCESS; 46 PVM pVM = pVCpu->CTX_SUFF(pVM); 47 if (!MSR_GIM_HV_HYPERCALL_IS_ENABLED(pVM->gim.s.u.Hv.u64HypercallMsr)) 48 return VERR_GIM_HYPERCALLS_NOT_ENABLED; 49 50 /** @todo Handle hypercalls. Fail for now */ 51 return VERR_GIM_IPE_3; 52 } 53 54 55 /** 56 * Returns whether the guest has configured and enabled the use of Hyper-V's 57 * hypercall interface. 58 * 59 * @returns true if hypercalls are enabled, false otherwise. 60 * @param pVCpu Pointer to the VMCPU. 61 */ 62 VMM_INT_DECL(bool) GIMHvAreHypercallsEnabled(PVMCPU pVCpu) 63 { 64 return MSR_GIM_HV_HYPERCALL_IS_ENABLED(pVCpu->CTX_SUFF(pVM)->gim.s.u.Hv.u64HypercallMsr); 47 65 } 48 66 -
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r51723 r52006 3831 3831 * 3832 3832 * @returns VBox status code. 3833 * @retval VINF_SUCCESS if the access was handled successfully. 3834 * @retval VERR_NOT_FOUND if no patch record for this eip could be found. 3835 * @retval VERR_SVM_UNEXPECTED_PATCH_TYPE if the found patch type is invalid. 3836 * 3833 3837 * @param pVM Pointer to the VM. 3834 3838 * @param pVCpu Pointer to the VMCPU. … … 3838 3842 { 3839 3843 Log4(("Emulated VMMCall TPR access replacement at RIP=%RGv\n", pCtx->rip)); 3844 bool fPatchFound = false; 3840 3845 for (;;) 3841 3846 { … … 3847 3852 break; 3848 3853 3854 fPatchFound = true; 3849 3855 switch (pPatch->enmType) 3850 3856 { … … 3888 3894 } 3889 3895 3890 return VINF_SUCCESS; 3896 if (fPatchFound) 3897 return VINF_SUCCESS; 3898 return VERR_NOT_FOUND; 3891 3899 } 3892 3900 … … 4896 4904 HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(); 4897 4905 4906 /* First check if this is a patched VMMCALL for mov TPR */ 4898 4907 int rc = hmR0SvmEmulateMovTpr(pVCpu->CTX_SUFF(pVM), pVCpu, pCtx); 4899 if ( RT_LIKELY(rc == VINF_SUCCESS))4908 if (rc == VINF_SUCCESS) 4900 4909 HMSVM_CHECK_SINGLE_STEP(pVCpu, rc); 4901 else 4910 else if (rc == VERR_NOT_FOUND) 4911 { 4912 /* Handle GIM provider hypercalls. */ 4913 rc = VERR_NOT_SUPPORTED; 4914 if (GIMAreHypercallsEnabled(pVCpu)) 4915 rc = GIMHypercall(pVCpu, pCtx); 4916 } 4917 4918 if (rc != VINF_SUCCESS) 4902 4919 hmR0SvmSetPendingXcptUD(pVCpu); 4903 4920 return VINF_SUCCESS; -
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r51981 r52006 371 371 static FNVMXEXITHANDLER hmR0VmxExitInvlpg; 372 372 static FNVMXEXITHANDLER hmR0VmxExitRdpmc; 373 static FNVMXEXITHANDLER hmR0VmxExitVmcall; 373 374 static FNVMXEXITHANDLER hmR0VmxExitRdtsc; 374 375 static FNVMXEXITHANDLER hmR0VmxExitRsm; … … 440 441 /* 16 VMX_EXIT_RDTSC */ hmR0VmxExitRdtsc, 441 442 /* 17 VMX_EXIT_RSM */ hmR0VmxExitRsm, 442 /* 18 VMX_EXIT_VMCALL */ hmR0VmxExit SetPendingXcptUD,443 /* 18 VMX_EXIT_VMCALL */ hmR0VmxExitVmcall, 443 444 /* 19 VMX_EXIT_VMCLEAR */ hmR0VmxExitSetPendingXcptUD, 444 445 /* 20 VMX_EXIT_VMLAUNCH */ hmR0VmxExitSetPendingXcptUD, … … 8924 8925 case VMX_EXIT_GETSEC: /* SVVMCS(); */ rc = hmR0VmxExitGetsec(pVCpu, pMixedCtx, pVmxTransient); /* LDVMCS(); */ break; 8925 8926 case VMX_EXIT_RDPMC: /* SVVMCS(); */ rc = hmR0VmxExitRdpmc(pVCpu, pMixedCtx, pVmxTransient); /* LDVMCS(); */ break; 8927 case VMX_EXIT_VMCALL: /* SVVMCS(); */ rc = hmR0VmxExitVmcall(pVCpu, pMixedCtx, pVmxTransient); /* LDVMCS(); */ break; 8926 8928 8927 8929 case VMX_EXIT_TRIPLE_FAULT: rc = hmR0VmxExitTripleFault(pVCpu, pMixedCtx, pVmxTransient); break; … … 8935 8937 case VMX_EXIT_ERR_MACHINE_CHECK: rc = hmR0VmxExitErrMachineCheck(pVCpu, pMixedCtx, pVmxTransient); break; 8936 8938 8937 case VMX_EXIT_VMCALL:8938 8939 case VMX_EXIT_VMCLEAR: 8939 8940 case VMX_EXIT_VMLAUNCH: … … 9977 9978 9978 9979 /** 9980 * VM-exit handler for VMCALL (VMX_EXIT_VMCALL). Unconditional VM-exit. 9981 */ 9982 HMVMX_EXIT_DECL hmR0VmxExitVmcall(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient) 9983 { 9984 HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(); 9985 9986 int rc = VERR_NOT_SUPPORTED; 9987 if (GIMAreHypercallsEnabled(pVCpu)) 9988 { 9989 rc = hmR0VmxSaveGuestState(pVCpu, pMixedCtx); 9990 AssertRCReturn(rc, rc); 9991 9992 rc = GIMHypercall(pVCpu, pMixedCtx); 9993 } 9994 if (rc != VINF_SUCCESS) 9995 { 9996 hmR0VmxSetPendingXcptUD(pVCpu, pMixedCtx); 9997 rc = VINF_SUCCESS; 9998 } 9999 10000 STAM_COUNTER_INC(&pVCpu->hm.s.StatExitVmcall); 10001 return rc; 10002 } 10003 10004 10005 /** 9979 10006 * VM-exit handler for INVLPG (VMX_EXIT_INVLPG). Conditional VM-exit. 9980 10007 */ -
trunk/src/VBox/VMM/include/GIMHvInternal.h
r51981 r52006 516 516 517 517 VMM_INT_DECL(bool) GIMHvIsParavirtTscEnabled(PVM pVM); 518 VMM_INT_DECL(bool) GIMHvAreHypercallsEnabled(PVMCPU pVCpu); 518 519 VMM_INT_DECL(int) GIMHvHypercall(PVMCPU pVCpu, PCPUMCTX pCtx); 519 520 VMM_INT_DECL(int) GIMHvReadMsr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue); -
trunk/src/VBox/VMM/include/HMInternal.h
r51643 r52006 857 857 STAMCOUNTER StatExitRdtscp; 858 858 STAMCOUNTER StatExitRdpmc; 859 STAMCOUNTER StatExitVmcall; 859 860 STAMCOUNTER StatExitRdrand; 860 861 STAMCOUNTER StatExitCli;
Note:
See TracChangeset
for help on using the changeset viewer.