Changeset 58014 in vbox
- Timestamp:
- Oct 2, 2015 5:33:16 PM (9 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/GIMAllHv.cpp
r58007 r58014 124 124 * Verify that hypercalls are enabled. 125 125 */ 126 if (! MSR_GIM_HV_HYPERCALL_IS_ENABLED(pVM->gim.s.u.Hv.u64HypercallMsr))126 if (!gimHvAreHypercallsEnabled(pVCpu)) 127 127 return VERR_GIM_HYPERCALLS_NOT_ENABLED; 128 128 … … 275 275 VMM_INT_DECL(bool) gimHvAreHypercallsEnabled(PVMCPU pVCpu) 276 276 { 277 return MSR_GIM_HV_HYPERCALL_IS_ENABLED(pVCpu->CTX_SUFF(pVM)->gim.s.u.Hv.u64HypercallMsr);277 return RT_BOOL(pVCpu->CTX_SUFF(pVM)->gim.s.u.Hv.u64GuestOsIdMsr != 0); 278 278 } 279 279 … … 481 481 return VINF_CPUM_R3_MSR_WRITE; 482 482 #else 483 /* Disable the hypercall-page if 0 is written to this MSR. */483 /* Disable the hypercall-page and hypercalls if 0 is written to this MSR. */ 484 484 if (!uRawValue) 485 485 { 486 gimR3HvDisableHypercallPage(pVM); 487 pHv->u64HypercallMsr &= ~MSR_GIM_HV_HYPERCALL_ENABLE_BIT; 488 LogRel(("GIM: HyperV: Hypercalls disabled via Guest OS ID Msr\n")); 486 if (MSR_GIM_HV_HYPERCALL_PAGE_IS_ENABLED(pHv->u64HypercallMsr)) 487 { 488 gimR3HvDisableHypercallPage(pVM); 489 pHv->u64HypercallMsr &= ~MSR_GIM_HV_HYPERCALL_PAGE_ENABLE_BIT; 490 LogRel(("GIM: HyperV: Hypercall page disabled via Guest OS ID MSR\n")); 491 } 489 492 } 490 493 else … … 510 513 AssertRC(rc2); 511 514 } 515 512 516 pHv->u64GuestOsIdMsr = uRawValue; 517 518 /* 519 * Notify VMM that hypercalls are now disabled/enabled. 520 */ 521 for (VMCPUID i = 0; i < pVM->cCpus; i++) 522 { 523 if (uRawValue) 524 VMMHypercallsEnable(&pVM->aCpus[i]); 525 else 526 VMMHypercallsDisable(&pVM->aCpus[i]); 527 } 528 513 529 return VINF_SUCCESS; 514 530 #endif /* IN_RING3 */ … … 528 544 return VINF_SUCCESS; 529 545 # else 530 /* First, update all but the hypercall enable bit. */531 pHv->u64HypercallMsr = (uRawValue & ~MSR_GIM_HV_HYPERCALL_ ENABLE_BIT);532 533 /* Hypercall s can only be enabled when the guest has set the Guest-OS Id Msr. */534 bool fEnable = RT_BOOL(uRawValue & MSR_GIM_HV_HYPERCALL_ ENABLE_BIT);546 /* First, update all but the hypercall page enable bit. */ 547 pHv->u64HypercallMsr = (uRawValue & ~MSR_GIM_HV_HYPERCALL_PAGE_ENABLE_BIT); 548 549 /* Hypercall page can only be enabled when the guest has enabled hypercalls. */ 550 bool fEnable = RT_BOOL(uRawValue & MSR_GIM_HV_HYPERCALL_PAGE_ENABLE_BIT); 535 551 if ( fEnable 536 && ! pHv->u64GuestOsIdMsr)552 && !gimHvAreHypercallsEnabled(pVCpu)) 537 553 { 538 554 return VINF_SUCCESS; -
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r57989 r58014 5165 5165 } 5166 5166 } 5167 else 5168 Log4(("hmR0SvmExitVmmCall: Hypercalls not enabled\n")); 5167 5169 } 5168 5170 -
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r57989 r58014 10162 10162 } 10163 10163 } 10164 else 10165 Log4(("hmR0VmxExitVmcall: Hypercalls not enabled\n")); 10164 10166 10165 10167 hmR0VmxSetPendingXcptUD(pVCpu, pMixedCtx); -
trunk/src/VBox/VMM/VMMR3/GIMHv.cpp
r58008 r58014 297 297 rc = gimR3HvInitDebugSupport(pVM); 298 298 AssertLogRelRCReturn(rc, rc); 299 300 /*301 * Pretend that hypercalls are enabled unconditionally when posing as Microsoft,302 * as Windows guests invoke debug hypercalls before enabling them via the hypercall MSR.303 */304 if (pHv->fIsVendorMsHv)305 {306 pHv->u64HypercallMsr |= MSR_GIM_HV_HYPERCALL_ENABLE_BIT;307 for (VMCPUID i = 0; i < pVM->cCpus; i++)308 VMMHypercallsEnable(&pVM->aCpus[i]);309 }310 299 } 311 300 … … 442 431 pHv->uCrashP3 = 0; 443 432 pHv->uCrashP4 = 0; 444 445 /* Extra faking required while posing as Microsoft, see gimR3HvInit(). */446 if ( (pHv->uMiscFeat & GIM_HV_MISC_FEAT_GUEST_DEBUGGING)447 && pHv->fIsVendorMsHv)448 {449 pHv->u64HypercallMsr |= MSR_GIM_HV_HYPERCALL_ENABLE_BIT;450 for (VMCPUID i = 0; i < pVM->cCpus; i++)451 VMMHypercallsEnable(&pVM->aCpus[i]);452 }453 433 } 454 434 … … 596 576 pRegion->cbRegion, PAGE_SIZE); 597 577 598 if (MSR_GIM_HV_HYPERCALL_ IS_ENABLED(pHv->u64HypercallMsr))578 if (MSR_GIM_HV_HYPERCALL_PAGE_IS_ENABLED(pHv->u64HypercallMsr)) 599 579 { 600 580 Assert(pRegion->GCPhysPage != NIL_RTGCPHYS); … … 805 785 pRegion->fMapped = false; 806 786 #endif 807 for (VMCPUID i = 0; i < pVM->cCpus; i++)808 VMMHypercallsDisable(&pVM->aCpus[i]);809 787 LogRel(("GIM: HyperV: Disabled Hypercall-page\n")); 810 788 return VINF_SUCCESS; … … 873 851 VMMHypercallsEnable(&pVM->aCpus[i]); 874 852 875 LogRel(("GIM: HyperV: Enabled hypercall sat %#RGp\n", GCPhysHypercallPage));853 LogRel(("GIM: HyperV: Enabled hypercall page at %#RGp\n", GCPhysHypercallPage)); 876 854 return VINF_SUCCESS; 877 855 } … … 911 889 if (RT_SUCCESS(rc)) 912 890 { 913 /*914 * Notify VMM that hypercalls are now enabled for all VCPUs.915 */916 for (VMCPUID i = 0; i < pVM->cCpus; i++)917 VMMHypercallsEnable(&pVM->aCpus[i]);918 919 891 pRegion->GCPhysPage = GCPhysHypercallPage; 920 892 pRegion->fMapped = true; 921 LogRel(("GIM: HyperV: Enabled hypercall sat %#RGp\n", GCPhysHypercallPage));893 LogRel(("GIM: HyperV: Enabled hypercall page at %#RGp\n", GCPhysHypercallPage)); 922 894 } 923 895 else -
trunk/src/VBox/VMM/include/GIMHvInternal.h
r57989 r58014 413 413 #define MSR_GIM_HV_HYPERCALL_GUEST_PFN(a) ((a) >> 12) 414 414 /** The hypercall enable bit. */ 415 #define MSR_GIM_HV_HYPERCALL_ ENABLE_BITRT_BIT_64(0)415 #define MSR_GIM_HV_HYPERCALL_PAGE_ENABLE_BIT RT_BIT_64(0) 416 416 /** Whether the hypercall-page is enabled or not. */ 417 #define MSR_GIM_HV_HYPERCALL_ IS_ENABLED(a) RT_BOOL((a) & MSR_GIM_HV_HYPERCALL_ENABLE_BIT)417 #define MSR_GIM_HV_HYPERCALL_PAGE_IS_ENABLED(a) RT_BOOL((a) & MSR_GIM_HV_HYPERCALL_PAGE_ENABLE_BIT) 418 418 /** @} */ 419 419
Note:
See TracChangeset
for help on using the changeset viewer.