Changeset 74469 in vbox for trunk/src/VBox
- Timestamp:
- Sep 26, 2018 6:46:28 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp.h
r74468 r74469 877 877 * @param pVCpu The cross context virtual CPU structure. 878 878 * @param uExitReason The VM-exit reason. 879 * @param uInstrId The VM-exit instruction identity (VMXINSTRID_XXX) if 880 * any. Pass VMXINSTRID_NONE otherwise. 881 * @param fPrimaryOpRead If the primary operand of the ModR/M byte (bits 0:3) is 882 * a read or write. 879 * @param uInstrId The VM-exit instruction identity (VMXINSTRID_XXX). 883 880 * @param pGCPtrDisp Where to store the displacement field. Optional, can be 884 881 * NULL. 885 882 */ 886 IEM_STATIC uint32_t iemVmxGetExitInstrInfo(PVMCPU pVCpu, uint32_t uExitReason, VMXINSTRID uInstrId, bool fPrimaryOpRead, 887 PRTGCPTR pGCPtrDisp) 883 IEM_STATIC uint32_t iemVmxGetExitInstrInfo(PVMCPU pVCpu, uint32_t uExitReason, VMXINSTRID uInstrId, PRTGCPTR pGCPtrDisp) 888 884 { 889 885 RTGCPTR GCPtrDisp; … … 907 903 uint8_t idxReg1; 908 904 uint8_t idxReg2; 909 if ( fPrimaryOpRead)905 if (!VMXINSTRID_IS_MODRM_PRIMARY_OP_W(uInstrId)) 910 906 { 911 907 idxReg1 = ((bRm >> X86_MODRM_REG_SHIFT) & X86_MODRM_REG_SMASK) | pVCpu->iem.s.uRexReg; … … 1153 1149 */ 1154 1150 uint8_t idxReg2; 1155 if ( fPrimaryOpRead)1151 if (!VMXINSTRID_IS_MODRM_PRIMARY_OP_W(uInstrId)) 1156 1152 { 1157 1153 idxReg2 = bRm & X86_MODRM_RM_MASK; … … 1187 1183 { 1188 1184 Assert(VMXINSTRID_IS_VALID(uInstrId)); 1185 Assert(VMXINSTRID_GET_ID(uInstrId) == (uInstrId & 0x3)); 1189 1186 ExitInstrInfo.GdtIdt.u2InstrId = VMXINSTRID_GET_ID(uInstrId); 1190 1187 ExitInstrInfo.GdtIdt.u2Undef0 = 0; … … 1195 1192 { 1196 1193 Assert(VMXINSTRID_IS_VALID(uInstrId)); 1194 Assert(VMXINSTRID_GET_ID(uInstrId) == (uInstrId & 0x3)); 1197 1195 ExitInstrInfo.LdtTr.u2InstrId = VMXINSTRID_GET_ID(uInstrId); 1198 1196 ExitInstrInfo.LdtTr.u2Undef0 = 0; … … 1211 1209 if (pGCPtrDisp) 1212 1210 *pGCPtrDisp = GCPtrDisp; 1211 1213 1212 return ExitInstrInfo.u; 1214 1213 } … … 3369 3368 3370 3369 /** 3370 * VMX VM-exit handler for VM-exits due to instruction execution. 3371 * 3372 * @param pVCpu The cross context virtual CPU structure. 3373 * @param uExitReason The VM-exit reason. 3374 * @param uInstrid The instruction identity (VMXINSTRID_XXX). 3375 * @param cbInstr The instruction length (in bytes). 3376 */ 3377 IEM_STATIC VBOXSTRICTRC iemVmxVmexitInstr(PVMCPU pVCpu, uint32_t uExitReason, VMXINSTRID uInstrId, uint8_t cbInstr) 3378 { 3379 /* Construct the VM-exit instruction information. */ 3380 RTGCPTR GCPtrDisp; 3381 uint32_t const uExitInstrInfo = iemVmxGetExitInstrInfo(pVCpu, uExitReason, uInstrId, &GCPtrDisp); 3382 3383 /* Update the VM-exit instruction information. */ 3384 iemVmxVmcsSetExitInstrInfo(pVCpu, uExitInstrInfo); 3385 3386 /* 3387 * Update the VM-exit qualification field with displacement bytes. 3388 * See Intel spec. 27.2.1 "Basic VM-Exit Information". 3389 */ 3390 switch (uExitReason) 3391 { 3392 case VMX_EXIT_INVEPT: 3393 case VMX_EXIT_INVPCID: 3394 case VMX_EXIT_LDTR_TR_ACCESS: 3395 case VMX_EXIT_GDTR_IDTR_ACCESS: 3396 case VMX_EXIT_VMCLEAR: 3397 case VMX_EXIT_VMPTRLD: 3398 case VMX_EXIT_VMPTRST: 3399 case VMX_EXIT_VMREAD: 3400 case VMX_EXIT_VMWRITE: 3401 case VMX_EXIT_VMXON: 3402 case VMX_EXIT_XRSTORS: 3403 case VMX_EXIT_XSAVES: 3404 case VMX_EXIT_RDRAND: 3405 case VMX_EXIT_RDSEED: 3406 iemVmxVmcsSetExitQual(pVCpu, GCPtrDisp); 3407 break; 3408 3409 default: 3410 AssertMsgFailedReturn(("Use instruction-specific handler\n"), VERR_IEM_IPE_5); 3411 } 3412 3413 /* Update the VM-exit instruction length field. */ 3414 Assert(cbInstr <= 15); 3415 iemVmxVmcsSetExitInstrLen(pVCpu, cbInstr); 3416 3417 /* Perform the VM-exit. */ 3418 return iemVmxVmexit(pVCpu, uExitReason); 3419 } 3420 3421 3422 /** 3371 3423 * Checks guest control registers, debug registers and MSRs as part of VM-entry. 3372 3424 * 3373 * @param pVCpu 3374 * @param pszInstr 3425 * @param pVCpu The cross context virtual CPU structure. 3426 * @param pszInstr The VMX instruction name (for logging purposes). 3375 3427 */ 3376 3428 IEM_STATIC int iemVmxVmentryCheckGuestControlRegsMsrs(PVMCPU pVCpu, const char *pszInstr) … … 3479 3531 IEM_VMX_VMENTRY_FAILED_RET(pVCpu, pszInstr, pszFailure, kVmxVDiag_Vmentry_GuestEferMsrRsvd); 3480 3532 3481 bool const fGstLma 3482 bool const fGstLme 3533 bool const fGstLma = RT_BOOL(pVmcs->u64HostEferMsr.u & MSR_K6_EFER_BIT_LMA); 3534 bool const fGstLme = RT_BOOL(pVmcs->u64HostEferMsr.u & MSR_K6_EFER_BIT_LME); 3483 3535 if ( fGstInLongMode == fGstLma 3484 3536 && ( !(pVmcs->u64GuestCr0.u & X86_CR0_PG)
Note:
See TracChangeset
for help on using the changeset viewer.