Changeset 75829 in vbox
- Timestamp:
- Nov 30, 2018 9:11:46 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r75828 r75829 7815 7815 * @sa hmR0VmxHandleMesaDrvGp 7816 7816 */ 7817 static int hmR0SvmHandleMesaDrvGp(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient, PCPUMCTX pCtx, PCSVMVMCB pVmcb) 7818 { 7817 static int hmR0SvmHandleMesaDrvGp(PVMCPU pVCpu, PCPUMCTX pCtx, PCSVMVMCB pVmcb) 7818 { 7819 HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, CPUMCTX_EXTRN_CS | CPUMCTX_EXTRN_RIP | CPUMCTX_EXTRN_RFLAGS | CPUMCTX_EXTRN_GPRS_MASK); 7819 7820 Log(("hmR0SvmHandleMesaDrvGp: at %04x:%08RX64 rcx=%RX64 rbx=%RX64\n", 7820 7821 pVmcb->guest.CS.u16Sel, pVmcb->guest.u64RIP, pCtx->rcx, pCtx->rbx)); 7821 RT_NOREF(pCtx, p SvmTransient, pVmcb);7822 RT_NOREF(pCtx, pVmcb); 7822 7823 7823 7824 /* For now we'll just skip the instruction. */ … … 7841 7842 /* Check magic and port. */ 7842 7843 Assert(!(pCtx->fExtrn & (CPUMCTX_EXTRN_RDX | CPUMCTX_EXTRN_RCX))); 7843 /*Log (("hmR0SvmIsMesaDrvGp: rax=%RX64 rdx=%RX64\n", pCtx->fExtrn & CPUMCTX_EXTRN_RAX ? pCtx->rax : pVmcb->guest.u64RAX, pCtx->rdx));*/7844 /*Log8(("hmR0SvmIsMesaDrvGp: rax=%RX64 rdx=%RX64\n", pCtx->fExtrn & CPUMCTX_EXTRN_RAX ? pVmcb->guest.u64RAX : pCtx->rax, pCtx->rdx));*/ 7844 7845 if (pCtx->dx != UINT32_C(0x5658)) 7845 7846 return false; 7846 if ((pCtx->fExtrn & CPUMCTX_EXTRN_RAX ? p Ctx->rax : pVmcb->guest.u64RAX) != UINT32_C(0x564d5868))7847 if ((pCtx->fExtrn & CPUMCTX_EXTRN_RAX ? pVmcb->guest.u64RAX : pCtx->rax) != UINT32_C(0x564d5868)) 7847 7848 return false; 7848 7849 … … 7852 7853 7853 7854 /* Flat ring-3 CS. */ 7854 /*Log (("hmR0SvmIsMesaDrvGp: u8CPL=%d base=%Rx64\n", pVmcb->guest.u8CPL, pCtx->fExtrn & CPUMCTX_EXTRN_CS ? pVmcb->guest.CS.u64Base : pCtx->cs.Sel));*/7855 /*Log8(("hmR0SvmIsMesaDrvGp: u8CPL=%d base=%RX64\n", pVmcb->guest.u8CPL, pCtx->fExtrn & CPUMCTX_EXTRN_CS ? pVmcb->guest.CS.u64Base : pCtx->cs.u64Base));*/ 7855 7856 if (pVmcb->guest.u8CPL != 3) 7856 7857 return false; 7857 if ((pCtx->fExtrn & CPUMCTX_EXTRN_CS ? pVmcb->guest.CS.u64Base : pCtx->cs. Sel) != 0)7858 if ((pCtx->fExtrn & CPUMCTX_EXTRN_CS ? pVmcb->guest.CS.u64Base : pCtx->cs.u64Base) != 0) 7858 7859 return false; 7859 7860 7860 7861 /* 0xed: IN eAX,dx */ 7861 uint64_t const uRip = pCtx->fExtrn & CPUMCTX_EXTRN_RIP ? pCtx->rip : pVmcb->guest.u64RIP; 7862 uint8_t abInstr[1]; 7863 if ( hmR0SvmSupportsNextRipSave(pVCpu) 7864 && pVmcb->ctrl.u64NextRIP - uRip != sizeof(abInstr)) 7865 return false; 7866 if (pVmcb->ctrl.cbInstrFetched >= 1) 7867 { 7868 /*Log(("hmR0SvmIsMesaDrvGp: %#x\n", pVmcb->ctrl.abInstr));*/ 7869 if (pVmcb->ctrl.abInstr[0] != 0xed) 7870 return false; 7871 } 7872 else 7873 { 7874 int rc = PGMPhysSimpleReadGCPtr(pVCpu, abInstr, uRip, sizeof(abInstr)); 7875 /*Log(("hmR0SvmIsMesaDrvGp: PGMPhysSimpleReadGCPtr -> %Rrc %#x\n", rc, abInstr[0]));*/ 7862 if (pVmcb->ctrl.cbInstrFetched < 1) /* unlikely, it turns out. */ 7863 { 7864 HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, CPUMCTX_EXTRN_CS | CPUMCTX_EXTRN_RIP | CPUMCTX_EXTRN_GPRS_MASK 7865 | CPUMCTX_EXTRN_CR0 | CPUMCTX_EXTRN_CR3 | CPUMCTX_EXTRN_CR4 | CPUMCTX_EXTRN_EFER); 7866 uint8_t abInstr[1]; 7867 int rc = PGMPhysSimpleReadGCPtr(pVCpu, abInstr, pCtx->rip, sizeof(abInstr)); 7868 /*Log8(("hmR0SvmIsMesaDrvGp: PGMPhysSimpleReadGCPtr -> %Rrc %#x\n", rc, abInstr[0])); */ 7876 7869 if (RT_FAILURE(rc)) 7877 7870 return false; … … 7879 7872 return false; 7880 7873 } 7881 7874 else 7875 { 7876 /*Log8(("hmR0SvmIsMesaDrvGp: %#x\n", pVmcb->ctrl.abInstr));*/ 7877 if (pVmcb->ctrl.abInstr[0] != 0xed) 7878 return false; 7879 } 7882 7880 return true; 7883 7881 } … … 7910 7908 return VINF_SUCCESS; 7911 7909 } 7912 return hmR0SvmHandleMesaDrvGp(pVCpu, p SvmTransient, pCtx, pVmcb);7910 return hmR0SvmHandleMesaDrvGp(pVCpu, pCtx, pVmcb); 7913 7911 } 7914 7912
Note:
See TracChangeset
for help on using the changeset viewer.