Changeset 75510 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Nov 16, 2018 8:36:57 AM (6 years ago)
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp.h
r75507 r75510 5909 5909 uint32_t const uVTpr = (uNewCrX & 0xf) << 4; 5910 5910 iemVmxVirtApicWriteRaw32(pVCpu, XAPIC_OFF_TPR, uVTpr); 5911 rcStrict = iemVmxVmexitTprVirtualization(pVCpu, cbInstr); 5912 if (rcStrict != VINF_VMX_INTERCEPT_NOT_ACTIVE) 5913 return rcStrict; 5914 rcStrict = VINF_SUCCESS; 5911 iemVmxVirtApicSignalAction(pVCpu, XAPIC_OFF_TPR); 5915 5912 break; 5916 5913 } … … 6693 6690 if (iemVmxIsRdmsrWrmsrInterceptSet(pVCpu, VMX_EXIT_RDMSR, pVCpu->cpum.GstCtx.ecx)) 6694 6691 IEM_VMX_VMEXIT_INSTR_RET(pVCpu, VMX_EXIT_RDMSR, cbInstr); 6695 6696 /** @todo NSTVMX: Handle other x2APIC MSRs in VMX non-root mode. Perhaps having a6697 * dedicated virtual-APIC device might be better... */6698 if ( pVCpu->cpum.GstCtx.ecx == MSR_IA32_X2APIC_TPR6699 && IEM_VMX_IS_PROCCTLS2_SET(pVCpu, VMX_PROC_CTLS2_VIRT_X2APIC_MODE))6700 {6701 uint32_t const uVTpr = iemVmxVirtApicReadRaw32(pVCpu, XAPIC_OFF_TPR);6702 pVCpu->cpum.GstCtx.rax = uVTpr;6703 pVCpu->cpum.GstCtx.rdx = 0;6704 iemRegAddToRipAndClearRF(pVCpu, cbInstr);6705 return VINF_SUCCESS;6706 }6707 6692 } 6708 6693 #endif … … 6779 6764 uValue.s.Hi = pVCpu->cpum.GstCtx.edx; 6780 6765 6766 uint32_t const idMsr = pVCpu->cpum.GstCtx.ecx; 6767 6781 6768 /** @todo make CPUMAllMsrs.cpp import the necessary MSR state. */ 6782 6769 IEM_CTX_IMPORT_RET(pVCpu, CPUMCTX_EXTRN_ALL_MSRS); … … 6788 6775 if (IEM_VMX_IS_NON_ROOT_MODE(pVCpu)) 6789 6776 { 6790 if (iemVmxIsRdmsrWrmsrInterceptSet(pVCpu, VMX_EXIT_WRMSR, pVCpu->cpum.GstCtx.ecx))6777 if (iemVmxIsRdmsrWrmsrInterceptSet(pVCpu, VMX_EXIT_WRMSR, idMsr)) 6791 6778 IEM_VMX_VMEXIT_INSTR_RET(pVCpu, VMX_EXIT_WRMSR, cbInstr); 6792 6793 /* Check x2APIC MSRs first. */6794 if (IEM_VMX_IS_PROCCTLS2_SET(pVCpu, VMX_PROC_CTLS2_VIRT_X2APIC_MODE))6795 {6796 switch (pVCpu->cpum.GstCtx.ecx)6797 {6798 case MSR_IA32_X2APIC_TPR:6799 {6800 if ( !uValue.s.Hi6801 && !(uValue.s.Lo & UINT32_C(0xffffff00)))6802 {6803 uint32_t const uVTpr = uValue.s.Lo;6804 iemVmxVirtApicWriteRaw32(pVCpu, XAPIC_OFF_TPR, uVTpr);6805 VBOXSTRICTRC rcStrict = iemVmxVmexitTprVirtualization(pVCpu, cbInstr);6806 if (rcStrict != VINF_VMX_INTERCEPT_NOT_ACTIVE)6807 return rcStrict;6808 return VINF_SUCCESS;6809 }6810 Log(("IEM: Invalid TPR MSR write (%#x,%#x) -> #GP(0)\n", uValue.s.Hi, uValue.s.Lo));6811 return iemRaiseGeneralProtectionFault0(pVCpu);6812 }6813 6814 case MSR_IA32_X2APIC_EOI:6815 case MSR_IA32_X2APIC_SELF_IPI:6816 {6817 /** @todo NSTVMX: EOI and Self-IPI virtualization. */6818 break;6819 }6820 }6821 }6822 else if (pVCpu->cpum.GstCtx.ecx == MSR_IA32_BIOS_UPDT_TRIG)6823 {6824 /** @todo NSTVMX: We must not allow any microcode updates in VMX non-root mode.6825 * Since we don't implement this MSR anyway it's currently not a problem.6826 * If we do, we should probably move this check to the MSR handler. */6827 }6828 else if (pVCpu->cpum.GstCtx.ecx == MSR_IA32_RTIT_CTL)6829 {6830 /** @todo NSTVMX: We don't support Intel PT yet. When we do, this MSR must #GP6831 * when IntelPT is not supported in VMX. */6832 }6833 6779 } 6834 6780 #endif … … 6837 6783 if (IEM_SVM_IS_CTRL_INTERCEPT_SET(pVCpu, SVM_CTRL_INTERCEPT_MSR_PROT)) 6838 6784 { 6839 VBOXSTRICTRC rcStrict = iemSvmHandleMsrIntercept(pVCpu, pVCpu->cpum.GstCtx.ecx, true /* fWrite */);6785 VBOXSTRICTRC rcStrict = iemSvmHandleMsrIntercept(pVCpu, idMsr, true /* fWrite */); 6840 6786 if (rcStrict == VINF_SVM_VMEXIT) 6841 6787 return VINF_SUCCESS; 6842 6788 if (rcStrict != VINF_SVM_INTERCEPT_NOT_ACTIVE) 6843 6789 { 6844 Log(("IEM: SVM intercepted rdmsr(%#x) failed. rc=%Rrc\n", pVCpu->cpum.GstCtx.ecx, VBOXSTRICTRC_VAL(rcStrict)));6790 Log(("IEM: SVM intercepted rdmsr(%#x) failed. rc=%Rrc\n", idMsr, VBOXSTRICTRC_VAL(rcStrict))); 6845 6791 return rcStrict; 6846 6792 } … … 6851 6797 * Do the job. 6852 6798 */ 6853 VBOXSTRICTRC rcStrict = CPUMSetGuestMsr(pVCpu, pVCpu->cpum.GstCtx.ecx, uValue.u);6799 VBOXSTRICTRC rcStrict = CPUMSetGuestMsr(pVCpu, idMsr, uValue.u); 6854 6800 if (rcStrict == VINF_SUCCESS) 6855 6801 { … … 6862 6808 if (rcStrict == VINF_CPUM_R3_MSR_WRITE) 6863 6809 { 6864 Log(("IEM: wrmsr(%#x) -> ring-3\n", pVCpu->cpum.GstCtx.ecx));6810 Log(("IEM: wrmsr(%#x) -> ring-3\n", idMsr)); 6865 6811 return rcStrict; 6866 6812 } … … 6871 6817 { 6872 6818 pVCpu->iem.s.cLogRelWrMsr++; 6873 LogRel(("IEM: wrmsr(%#x,%#x`%08x) -> #GP(0)\n", pVCpu->cpum.GstCtx.ecx, uValue.s.Hi, uValue.s.Lo));6819 LogRel(("IEM: wrmsr(%#x,%#x`%08x) -> #GP(0)\n", idMsr, uValue.s.Hi, uValue.s.Lo)); 6874 6820 } 6875 6821 else 6876 Log(( "IEM: wrmsr(%#x,%#x`%08x) -> #GP(0)\n", pVCpu->cpum.GstCtx.ecx, uValue.s.Hi, uValue.s.Lo));6822 Log(( "IEM: wrmsr(%#x,%#x`%08x) -> #GP(0)\n", idMsr, uValue.s.Hi, uValue.s.Lo)); 6877 6823 AssertMsgReturn(rcStrict == VERR_CPUM_RAISE_GP_0, ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)), VERR_IPE_UNEXPECTED_STATUS); 6878 6824 return iemRaiseGeneralProtectionFault0(pVCpu); -
trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp.h
r75507 r75510 911 911 912 912 /** 913 * Signal that a virtual-APIC action needs to be performed at a later time (post 914 * instruction execution). 915 * 916 * @param pVCpu The cross context virtual CPU structure. 917 * @param offApic The virtual-APIC page offset that was updated pertaining to 918 * the event. 919 */ 920 DECLINLINE(void) iemVmxVirtApicSignalAction(PVMCPU pVCpu, uint16_t offApic) 921 { 922 Assert(offApic < XAPIC_OFF_END + 4); 923 924 /* 925 * Record the currently updated APIC offset, as we need this later for figuring 926 * out whether to perform TPR, EOI or self-IPI virtualization as well as well 927 * as for supplying the exit qualification when causing an APIC-write VM-exit. 928 */ 929 pVCpu->cpum.GstCtx.hwvirt.vmx.offVirtApicWrite = offApic; 930 931 /* 932 * Signal that we need to perform a virtual-APIC action (TPR/PPR/EOI/Self-IPI 933 * virtualization or APIC-write emulation). 934 */ 935 if (!VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_VMX_UPDATE_VAPIC)) 936 VMCPU_FF_SET(pVCpu, VMCPU_FF_VMX_UPDATE_VAPIC); 937 } 938 939 940 /** 913 941 * Masks the nested-guest CR0/CR4 mask subjected to the corresponding guest/host 914 942 * mask and the read-shadow (CR0/CR4 read). … … 4314 4342 { 4315 4343 /* 4316 * Record the currently updated APIC offset, as we need this later for figuring4317 * out whether to perform TPR, EOI or self-IPI virtualization as well as well4318 * as for supplying the exit qualification when causing an APIC-write VM-exit.4319 */4320 pVCpu->cpum.GstCtx.hwvirt.vmx.offVirtApicWrite = offAccess;4321 4322 /*4323 4344 * A write access to the APIC-access page that is virtualized (rather than 4324 4345 * causing a VM-exit) writes data to the virtual-APIC page. … … 4328 4349 4329 4350 /* 4351 * Record the currently updated APIC offset, as we need this later for figuring 4352 * out whether to perform TPR, EOI or self-IPI virtualization as well as well 4353 * as for supplying the exit qualification when causing an APIC-write VM-exit. 4354 * 4330 4355 * After completion of the current operation, we need to perform TPR virtualization, 4331 4356 * EOI virtualization or APIC-write VM-exit depending on which register was written. … … 4339 4364 * See Intel spec. 29.4.3.2 "APIC-Write Emulation". 4340 4365 */ 4341 VMCPU_FF_SET(pVCpu, VMCPU_FF_VMX_UPDATE_VAPIC);4366 iemVmxVirtApicSignalAction(pVCpu, offAccess); 4342 4367 } 4343 4368 else … … 4423 4448 * @retval VERR_OUT_RANGE if the MSR read was supposed to be virtualized but was 4424 4449 * not within the range of valid MSRs, caller must raise \#GP(0). 4450 * @retval VINF_VMX_INTERCEPT_NOT_ACTIVE if the MSR must be written normally. 4425 4451 * 4426 4452 * @param pVCpu The cross context virtual CPU structure. … … 4469 4495 * as for supplying the exit qualification when causing an APIC-write VM-exit. 4470 4496 */ 4471 pVCpu->cpum.GstCtx.hwvirt.vmx.offVirtApicWrite = offReg; 4472 VMCPU_FF_SET(pVCpu, VMCPU_FF_VMX_UPDATE_VAPIC); 4497 iemVmxVirtApicSignalAction(pVCpu, offReg); 4473 4498 4474 4499 return VINF_VMX_MODIFIES_BEHAVIOR;
Note:
See TracChangeset
for help on using the changeset viewer.