Changeset 71092 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Feb 22, 2018 9:14:46 AM (7 years ago)
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r71079 r71092 412 412 413 413 /** 414 * Updates the NextRIP (NRI) field in the nested-guest VMCB. 415 */ 416 # define IEM_SVM_UPDATE_NRIP(a_pVCpu) \ 417 do { \ 418 if (IEM_GET_GUEST_CPU_FEATURES(a_pVCpu)->fSvmNextRipSave) \ 419 CPUMGuestSvmUpdateNRip(a_pVCpu, IEM_GET_CTX(a_pVCpu), IEM_GET_INSTR_LEN(a_pVCpu)); \ 420 } while (0) 421 422 /** 414 423 * Check if an SVM is enabled. 415 424 */ … … 473 482 #else 474 483 # define IEM_SVM_INSTR_COMMON_CHECKS(a_pVCpu, a_Instr) do { } while (0) 484 # define IEM_SVM_UPDATE_NRIP(a_pVCpu) do { } while (0) 475 485 # define IEM_IS_SVM_ENABLED(a_pVCpu) (false) 476 486 # define IEM_IS_SVM_CTRL_INTERCEPT_SET(a_pVCpu, a_Intercept) (false) … … 12839 12849 12840 12850 #ifdef VBOX_WITH_NESTED_HWVIRT 12841 /** Check and handles SVM nested-guest control & instruction intercept. */ 12842 # define IEMOP_HLP_SVM_CTRL_INTERCEPT(a_pVCpu, a_Intercept, a_uExitCode, a_uExitInfo1, a_uExitInfo2) \ 12851 /** Check and handles SVM nested-guest instruction intercept and updates 12852 * NRIP if needed. */ 12853 # define IEMOP_HLP_SVM_INSTR_INTERCEPT_AND_NRIP(a_pVCpu, a_Intercept, a_uExitCode, a_uExitInfo1, a_uExitInfo2) \ 12843 12854 do \ 12844 12855 { \ 12845 12856 if (IEM_IS_SVM_CTRL_INTERCEPT_SET(a_pVCpu, a_Intercept)) \ 12857 { \ 12858 IEM_SVM_UPDATE_NRIP(a_pVCpu); \ 12846 12859 IEM_RETURN_SVM_VMEXIT(a_pVCpu, a_uExitCode, a_uExitInfo1, a_uExitInfo2); \ 12860 } \ 12847 12861 } while (0) 12848 12862 … … 12852 12866 { \ 12853 12867 if (IEM_IS_SVM_READ_CR_INTERCEPT_SET(a_pVCpu, a_uCr)) \ 12868 { \ 12869 IEM_SVM_UPDATE_NRIP(a_pVCpu); \ 12854 12870 IEM_RETURN_SVM_VMEXIT(a_pVCpu, SVM_EXIT_READ_CR0 + (a_uCr), a_uExitInfo1, a_uExitInfo2); \ 12871 } \ 12855 12872 } while (0) 12856 12873 12857 12874 #else /* !VBOX_WITH_NESTED_HWVIRT */ 12858 # define IEMOP_HLP_SVM_ CTRL_INTERCEPT(a_pVCpu, a_Intercept, a_uExitCode, a_uExitInfo1, a_uExitInfo2)do { } while (0)12859 # define IEMOP_HLP_SVM_READ_CR_INTERCEPT(a_pVCpu, a_uCr, a_uExitInfo1, a_uExitInfo2) do { } while (0)12875 # define IEMOP_HLP_SVM_INSTR_INTERCEPT_AND_NRIP(a_pVCpu, a_Intercept, a_uExitCode, a_uExitInfo1, a_uExitInfo2) do { } while (0) 12876 # define IEMOP_HLP_SVM_READ_CR_INTERCEPT(a_pVCpu, a_uCr, a_uExitInfo1, a_uExitInfo2) do { } while (0) 12860 12877 #endif /* !VBOX_WITH_NESTED_HWVIRT */ 12861 12878 -
trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp.h
r71077 r71092 565 565 { 566 566 Log2(("pushf: Guest intercept -> #VMEXIT\n")); 567 IEM_SVM_UPDATE_NRIP(pVCpu); 567 568 IEM_RETURN_SVM_VMEXIT(pVCpu, SVM_EXIT_PUSHF, 0 /* uExitInfo1 */, 0 /* uExitInfo2 */); 568 569 } … … 632 633 { 633 634 Log2(("popf: Guest intercept -> #VMEXIT\n")); 635 IEM_SVM_UPDATE_NRIP(pVCpu); 634 636 IEM_RETURN_SVM_VMEXIT(pVCpu, SVM_EXIT_POPF, 0 /* uExitInfo1 */, 0 /* uExitInfo2 */); 635 637 } … … 3879 3881 { 3880 3882 Log(("iret: Guest intercept -> #VMEXIT\n")); 3883 IEM_SVM_UPDATE_NRIP(pVCpu); 3881 3884 IEM_RETURN_SVM_VMEXIT(pVCpu, SVM_EXIT_IRET, 0 /* uExitInfo1 */, 0 /* uExitInfo2 */); 3882 3885 } … … 4662 4665 { 4663 4666 Log(("lgdt: Guest intercept -> #VMEXIT\n")); 4667 IEM_SVM_UPDATE_NRIP(pVCpu); 4664 4668 IEM_RETURN_SVM_VMEXIT(pVCpu, SVM_EXIT_GDTR_WRITE, 0 /* uExitInfo1 */, 0 /* uExitInfo2 */); 4665 4669 } … … 4713 4717 { 4714 4718 Log(("sgdt: Guest intercept -> #VMEXIT\n")); 4719 IEM_SVM_UPDATE_NRIP(pVCpu); 4715 4720 IEM_RETURN_SVM_VMEXIT(pVCpu, SVM_EXIT_GDTR_READ, 0 /* uExitInfo1 */, 0 /* uExitInfo2 */); 4716 4721 } … … 4740 4745 { 4741 4746 Log(("lidt: Guest intercept -> #VMEXIT\n")); 4747 IEM_SVM_UPDATE_NRIP(pVCpu); 4742 4748 IEM_RETURN_SVM_VMEXIT(pVCpu, SVM_EXIT_IDTR_WRITE, 0 /* uExitInfo1 */, 0 /* uExitInfo2 */); 4743 4749 } … … 4790 4796 { 4791 4797 Log(("sidt: Guest intercept -> #VMEXIT\n")); 4798 IEM_SVM_UPDATE_NRIP(pVCpu); 4792 4799 IEM_RETURN_SVM_VMEXIT(pVCpu, SVM_EXIT_IDTR_READ, 0 /* uExitInfo1 */, 0 /* uExitInfo2 */); 4793 4800 } … … 4838 4845 { 4839 4846 Log(("lldt: Guest intercept -> #VMEXIT\n")); 4847 IEM_SVM_UPDATE_NRIP(pVCpu); 4840 4848 IEM_RETURN_SVM_VMEXIT(pVCpu, SVM_EXIT_LDTR_WRITE, 0 /* uExitInfo1 */, 0 /* uExitInfo2 */); 4841 4849 } … … 4919 4927 { 4920 4928 Log(("lldt: Guest intercept -> #VMEXIT\n")); 4929 IEM_SVM_UPDATE_NRIP(pVCpu); 4921 4930 IEM_RETURN_SVM_VMEXIT(pVCpu, SVM_EXIT_LDTR_WRITE, 0 /* uExitInfo1 */, 0 /* uExitInfo2 */); 4922 4931 } … … 4976 4985 { 4977 4986 Log(("ltr: Guest intercept -> #VMEXIT\n")); 4987 IEM_SVM_UPDATE_NRIP(pVCpu); 4978 4988 IEM_RETURN_SVM_VMEXIT(pVCpu, SVM_EXIT_TR_WRITE, 0 /* uExitInfo1 */, 0 /* uExitInfo2 */); 4979 4989 } … … 5083 5093 { 5084 5094 Log(("iemCImpl_mov_Rd_Cd: Guest intercept CR%u -> #VMEXIT\n", iCrReg)); 5095 IEM_SVM_UPDATE_NRIP(pVCpu); 5085 5096 IEM_RETURN_SVM_CRX_VMEXIT(pVCpu, SVM_EXIT_READ_CR0 + iCrReg, IEMACCESSCRX_MOV_CRX, iGReg); 5086 5097 } … … 5233 5244 { 5234 5245 Log(("iemCImpl_load_Cr%#x: Guest intercept -> #VMEXIT\n", iCrReg)); 5246 IEM_SVM_UPDATE_NRIP(pVCpu); 5235 5247 IEM_RETURN_SVM_CRX_VMEXIT(pVCpu, SVM_EXIT_WRITE_CR0, enmAccessCrX, iGReg); 5236 5248 } … … 5243 5255 Assert(enmAccessCrX != IEMACCESSCRX_CLTS); 5244 5256 Log(("iemCImpl_load_Cr%#x: TS/MP bit changed or lmsw instr: Guest intercept -> #VMEXIT\n", iCrReg)); 5257 IEM_SVM_UPDATE_NRIP(pVCpu); 5245 5258 IEM_RETURN_SVM_VMEXIT(pVCpu, SVM_EXIT_CR0_SEL_WRITE, 0 /* uExitInfo1 */, 0 /* uExitInfo2 */); 5246 5259 } … … 5310 5323 { 5311 5324 Log(("iemCImpl_load_Cr%#x: Guest intercept -> #VMEXIT\n", iCrReg)); 5325 IEM_SVM_UPDATE_NRIP(pVCpu); 5312 5326 IEM_RETURN_SVM_CRX_VMEXIT(pVCpu, SVM_EXIT_WRITE_CR2, enmAccessCrX, iGReg); 5313 5327 } … … 5362 5376 { 5363 5377 Log(("iemCImpl_load_Cr%#x: Guest intercept -> #VMEXIT\n", iCrReg)); 5378 IEM_SVM_UPDATE_NRIP(pVCpu); 5364 5379 IEM_RETURN_SVM_CRX_VMEXIT(pVCpu, SVM_EXIT_WRITE_CR3, enmAccessCrX, iGReg); 5365 5380 } … … 5447 5462 { 5448 5463 Log(("iemCImpl_load_Cr%#x: Guest intercept -> #VMEXIT\n", iCrReg)); 5464 IEM_SVM_UPDATE_NRIP(pVCpu); 5449 5465 IEM_RETURN_SVM_CRX_VMEXIT(pVCpu, SVM_EXIT_WRITE_CR4, enmAccessCrX, iGReg); 5450 5466 } … … 5509 5525 { 5510 5526 Log(("iemCImpl_load_Cr%#x: Guest intercept -> #VMEXIT\n", iCrReg)); 5527 IEM_SVM_UPDATE_NRIP(pVCpu); 5511 5528 IEM_RETURN_SVM_CRX_VMEXIT(pVCpu, SVM_EXIT_WRITE_CR8, enmAccessCrX, iGReg); 5512 5529 } … … 5673 5690 { 5674 5691 Log(("mov r%u,dr%u: Guest intercept -> #VMEXIT\n", iGReg, iDrReg)); 5692 IEM_SVM_UPDATE_NRIP(pVCpu); 5675 5693 IEM_RETURN_SVM_VMEXIT(pVCpu, SVM_EXIT_READ_DR0 + (iDrReg & 0xf), 5676 5694 IEM_GET_GUEST_CPU_FEATURES(pVCpu)->fSvmDecodeAssists ? (iGReg & 7) : 0, 0 /* uExitInfo2 */); … … 5774 5792 { 5775 5793 Log2(("mov dr%u,r%u: Guest intercept -> #VMEXIT\n", iDrReg, iGReg)); 5794 IEM_SVM_UPDATE_NRIP(pVCpu); 5776 5795 IEM_RETURN_SVM_VMEXIT(pVCpu, SVM_EXIT_WRITE_DR0 + (iDrReg & 0xf), 5777 5796 IEM_GET_GUEST_CPU_FEATURES(pVCpu)->fSvmDecodeAssists ? (iGReg & 7) : 0, 0 /* uExitInfo2 */); … … 5810 5829 { 5811 5830 Log(("invlpg: Guest intercept (%RGp) -> #VMEXIT\n", GCPtrPage)); 5831 IEM_SVM_UPDATE_NRIP(pVCpu); 5812 5832 IEM_RETURN_SVM_VMEXIT(pVCpu, SVM_EXIT_INVLPG, 5813 5833 IEM_GET_GUEST_CPU_FEATURES(pVCpu)->fSvmDecodeAssists ? GCPtrPage : 0, 0 /* uExitInfo2 */); … … 5954 5974 { 5955 5975 Log(("rdtsc: Guest intercept -> #VMEXIT\n")); 5976 IEM_SVM_UPDATE_NRIP(pVCpu); 5956 5977 IEM_RETURN_SVM_VMEXIT(pVCpu, SVM_EXIT_RDTSC, 0 /* uExitInfo1 */, 0 /* uExitInfo2 */); 5957 5978 } … … 5998 6019 { 5999 6020 Log(("rdtscp: Guest intercept -> #VMEXIT\n")); 6021 IEM_SVM_UPDATE_NRIP(pVCpu); 6000 6022 IEM_RETURN_SVM_VMEXIT(pVCpu, SVM_EXIT_RDTSCP, 0 /* uExitInfo1 */, 0 /* uExitInfo2 */); 6001 6023 } … … 6039 6061 { 6040 6062 Log(("rdpmc: Guest intercept -> #VMEXIT\n")); 6063 IEM_SVM_UPDATE_NRIP(pVCpu); 6041 6064 IEM_RETURN_SVM_VMEXIT(pVCpu, SVM_EXIT_RDPMC, 0 /* uExitInfo1 */, 0 /* uExitInfo2 */); 6042 6065 } … … 6483 6506 { 6484 6507 Log2(("hlt: Guest intercept -> #VMEXIT\n")); 6508 IEM_SVM_UPDATE_NRIP(pVCpu); 6485 6509 IEM_RETURN_SVM_VMEXIT(pVCpu, SVM_EXIT_HLT, 0 /* uExitInfo1 */, 0 /* uExitInfo2 */); 6486 6510 } … … 6537 6561 { 6538 6562 Log2(("monitor: Guest intercept -> #VMEXIT\n")); 6563 IEM_SVM_UPDATE_NRIP(pVCpu); 6539 6564 IEM_RETURN_SVM_VMEXIT(pVCpu, SVM_EXIT_MONITOR, 0 /* uExitInfo1 */, 0 /* uExitInfo2 */); 6540 6565 } … … 6604 6629 { 6605 6630 Log2(("mwait: Guest intercept (monitor hardware armed) -> #VMEXIT\n")); 6631 IEM_SVM_UPDATE_NRIP(pVCpu); 6606 6632 IEM_RETURN_SVM_VMEXIT(pVCpu, SVM_EXIT_MWAIT_ARMED, 0 /* uExitInfo1 */, 0 /* uExitInfo2 */); 6607 6633 } … … 6609 6635 { 6610 6636 Log2(("mwait: Guest intercept -> #VMEXIT\n")); 6637 IEM_SVM_UPDATE_NRIP(pVCpu); 6611 6638 IEM_RETURN_SVM_VMEXIT(pVCpu, SVM_EXIT_MWAIT, 0 /* uExitInfo1 */, 0 /* uExitInfo2 */); 6612 6639 } … … 6661 6688 { 6662 6689 Log2(("cpuid: Guest intercept -> #VMEXIT\n")); 6690 IEM_SVM_UPDATE_NRIP(pVCpu); 6663 6691 IEM_RETURN_SVM_VMEXIT(pVCpu, SVM_EXIT_CPUID, 0 /* uExitInfo1 */, 0 /* uExitInfo2 */); 6664 6692 } … … 7014 7042 { 7015 7043 Log2(("xsetbv: Guest intercept -> #VMEXIT\n")); 7044 IEM_SVM_UPDATE_NRIP(pVCpu); 7016 7045 IEM_RETURN_SVM_VMEXIT(pVCpu, SVM_EXIT_XSETBV, 0 /* uExitInfo1 */, 0 /* uExitInfo2 */); 7017 7046 } -
trunk/src/VBox/VMM/VMMAll/IEMAllInstructionsOneByte.cpp.h
r69111 r71092 4461 4461 Assert(!IEM_GET_GUEST_CPU_FEATURES(pVCpu)->fSvmPauseFilterThreshold); 4462 4462 #endif 4463 IEMOP_HLP_SVM_ CTRL_INTERCEPT(pVCpu, SVM_CTRL_INTERCEPT_PAUSE, SVM_EXIT_PAUSE, 0, 0);4463 IEMOP_HLP_SVM_INSTR_INTERCEPT_AND_NRIP(pVCpu, SVM_CTRL_INTERCEPT_PAUSE, SVM_EXIT_PAUSE, 0, 0); 4464 4464 } 4465 4465 else -
trunk/src/VBox/VMM/VMMAll/IEMAllInstructionsTwoByte0f.cpp.h
r70643 r71092 35 35 { 36 36 IEMOP_HLP_DECODED_NL_1(OP_SLDT, IEMOPFORM_M_REG, OP_PARM_Ew, DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP); 37 IEMOP_HLP_SVM_ CTRL_INTERCEPT(pVCpu, SVM_CTRL_INTERCEPT_LDTR_READS, SVM_EXIT_LDTR_READ, 0, 0);37 IEMOP_HLP_SVM_INSTR_INTERCEPT_AND_NRIP(pVCpu, SVM_CTRL_INTERCEPT_LDTR_READS, SVM_EXIT_LDTR_READ, 0, 0); 38 38 switch (pVCpu->iem.s.enmEffOpSize) 39 39 { … … 75 75 IEM_MC_CALC_RM_EFF_ADDR(GCPtrEffDst, bRm, 0); 76 76 IEMOP_HLP_DECODED_NL_1(OP_SLDT, IEMOPFORM_M_MEM, OP_PARM_Ew, DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP); 77 IEMOP_HLP_SVM_ CTRL_INTERCEPT(pVCpu, SVM_CTRL_INTERCEPT_LDTR_READS, SVM_EXIT_LDTR_READ, 0, 0);77 IEMOP_HLP_SVM_INSTR_INTERCEPT_AND_NRIP(pVCpu, SVM_CTRL_INTERCEPT_LDTR_READS, SVM_EXIT_LDTR_READ, 0, 0); 78 78 IEM_MC_FETCH_LDTR_U16(u16Ldtr); 79 79 IEM_MC_STORE_MEM_U16(pVCpu->iem.s.iEffSeg, GCPtrEffDst, u16Ldtr); … … 95 95 { 96 96 IEMOP_HLP_DECODED_NL_1(OP_STR, IEMOPFORM_M_REG, OP_PARM_Ew, DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP); 97 IEMOP_HLP_SVM_ CTRL_INTERCEPT(pVCpu, SVM_CTRL_INTERCEPT_TR_READS, SVM_EXIT_TR_READ, 0, 0);97 IEMOP_HLP_SVM_INSTR_INTERCEPT_AND_NRIP(pVCpu, SVM_CTRL_INTERCEPT_TR_READS, SVM_EXIT_TR_READ, 0, 0); 98 98 switch (pVCpu->iem.s.enmEffOpSize) 99 99 { … … 135 135 IEM_MC_CALC_RM_EFF_ADDR(GCPtrEffDst, bRm, 0); 136 136 IEMOP_HLP_DECODED_NL_1(OP_STR, IEMOPFORM_M_MEM, OP_PARM_Ew, DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP); 137 IEMOP_HLP_SVM_ CTRL_INTERCEPT(pVCpu, SVM_CTRL_INTERCEPT_TR_READS, SVM_EXIT_TR_READ, 0, 0);137 IEMOP_HLP_SVM_INSTR_INTERCEPT_AND_NRIP(pVCpu, SVM_CTRL_INTERCEPT_TR_READS, SVM_EXIT_TR_READ, 0, 0); 138 138 IEM_MC_FETCH_TR_U16(u16Tr); 139 139 IEM_MC_STORE_MEM_U16(pVCpu->iem.s.iEffSeg, GCPtrEffDst, u16Tr); … … 653 653 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 654 654 /** @todo SVM intercept removal from here. */ 655 IEMOP_HLP_SVM_ CTRL_INTERCEPT(pVCpu, SVM_CTRL_INTERCEPT_RDTSCP, SVM_EXIT_RDTSCP, 0, 0);655 IEMOP_HLP_SVM_INSTR_INTERCEPT_AND_NRIP(pVCpu, SVM_CTRL_INTERCEPT_RDTSCP, SVM_EXIT_RDTSCP, 0, 0); 656 656 return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_rdtscp); 657 657 } … … 889 889 #ifdef VBOX_WITH_NESTED_HWVIRT 890 890 IEM_MC_RAISE_GP0_IF_CPL_NOT_ZERO(); 891 IEMOP_HLP_SVM_ CTRL_INTERCEPT(pVCpu, SVM_CTRL_INTERCEPT_INVD, SVM_EXIT_INVD, 0, 0);891 IEMOP_HLP_SVM_INSTR_INTERCEPT_AND_NRIP(pVCpu, SVM_CTRL_INTERCEPT_INVD, SVM_EXIT_INVD, 0, 0); 892 892 #else 893 893 RT_NOREF_PV(pVCpu); … … 910 910 IEM_MC_BEGIN(0, 0); 911 911 IEM_MC_RAISE_GP0_IF_CPL_NOT_ZERO(); 912 IEMOP_HLP_SVM_ CTRL_INTERCEPT(pVCpu, SVM_CTRL_INTERCEPT_WBINVD, SVM_EXIT_WBINVD, 0, 0);912 IEMOP_HLP_SVM_INSTR_INTERCEPT_AND_NRIP(pVCpu, SVM_CTRL_INTERCEPT_WBINVD, SVM_EXIT_WBINVD, 0, 0); 913 913 IEM_MC_ADVANCE_RIP(); 914 914 IEM_MC_END(); … … 6665 6665 { 6666 6666 IEMOP_MNEMONIC(rsm, "rsm"); 6667 IEMOP_HLP_SVM_ CTRL_INTERCEPT(pVCpu, SVM_CTRL_INTERCEPT_RSM, SVM_EXIT_RSM, 0, 0);6667 IEMOP_HLP_SVM_INSTR_INTERCEPT_AND_NRIP(pVCpu, SVM_CTRL_INTERCEPT_RSM, SVM_EXIT_RSM, 0, 0); 6668 6668 /** @todo rsm - for the regular case (above handles only the SVM nested-guest 6669 6669 * intercept). */
Note:
See TracChangeset
for help on using the changeset viewer.