Changeset 56080 in vbox
- Timestamp:
- May 26, 2015 2:36:27 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/err.h
r56047 r56080 2059 2059 /** Unknown or unrecognized SVM exit. */ 2060 2060 #define VERR_SVM_UNKNOWN_EXIT (-4060) 2061 /** Internal SVM processing error no 1. */ 2062 #define VERR_SVM_IPE_1 (-4061) 2063 /** Internal SVM processing error no 2. */ 2064 #define VERR_SVM_IPE_2 (-4062) 2065 /** Internal SVM processing error no 3. */ 2066 #define VERR_SVM_IPE_3 (-4063) 2067 /** Internal SVM processing error no 4. */ 2068 #define VERR_SVM_IPE_4 (-4064) 2069 /** Internal SVM processing error no 5. */ 2070 #define VERR_SVM_IPE_5 (-4065) 2061 2071 /** @} */ 2062 2072 -
trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp
r56072 r56080 16 16 */ 17 17 18 //#define IOM_USE_IEM_FOR_MMIO19 18 20 19 /******************************************************************************* … … 30 29 #include <VBox/vmm/pgm.h> 31 30 #include <VBox/vmm/trpm.h> 32 #if defined(IOM_USE_IEM_FOR_MMIO) || (defined(IEM_VERIFICATION_MODE) && defined(IN_RING3)) 33 # include <VBox/vmm/iem.h> 34 #endif 31 #include <VBox/vmm/iem.h> 35 32 #include "IOMInternal.h" 36 33 #include <VBox/vmm/vm.h> … … 723 720 724 721 725 #ifndef IOM_USE_IEM_FOR_MMIO722 #ifndef VBOX_WITH_2ND_IEM_STEP 726 723 727 724 /** … … 820 817 } 821 818 822 #endif /* !IOM_USE_IEM_FOR_MMIO */823 824 819 825 820 /** Wrapper for reading virtual memory. */ … … 1121 1116 1122 1117 1123 #ifndef IOM_USE_IEM_FOR_MMIO1124 1125 1118 /** 1126 1119 * [REP] STOSB … … 1654 1647 } 1655 1648 1656 #endif /* ! IOM_USE_IEM_FOR_MMIO*/1649 #endif /* !VBOX_WITH_2ND_IEM_STEP */ 1657 1650 1658 1651 /** … … 1744 1737 } 1745 1738 1746 #ifdef IOM_USE_IEM_FOR_MMIO1739 #ifdef VBOX_WITH_2ND_IEM_STEP 1747 1740 1748 1741 /* … … 1903 1896 iomMmioReleaseRange(pVM, pRange); 1904 1897 return rc; 1905 #endif /* ! IOM_USE_IEM_FOR_MMIO*/1898 #endif /* !VBOX_WITH_2ND_IEM_STEP */ 1906 1899 } 1907 1900 … … 2022 2015 } 2023 2016 2017 2018 #ifdef IN_RING3 /* Only used by REM. */ 2024 2019 2025 2020 /** … … 2261 2256 } 2262 2257 2258 #endif /* IN_RING3 - only used by REM. */ 2259 #ifndef VBOX_WITH_2ND_IEM_STEP 2263 2260 2264 2261 /** … … 2502 2499 return rcStrict; 2503 2500 } 2501 2502 #endif /* !VBOX_WITH_2ND_IEM_STEP */ 2504 2503 2505 2504 … … 2606 2605 * Lookup the context range node the page belongs to. 2607 2606 */ 2608 # ifdef VBOX_STRICT2607 # ifdef VBOX_STRICT 2609 2608 /* Can't lock IOM here due to potential deadlocks in the VGA device; not safe to access. */ 2610 2609 PIOMMMIORANGE pRange = iomMMIOGetRangeUnsafe(pVM, pVCpu, GCPhys); … … 2613 2612 Assert((pRange->GCPhys & PAGE_OFFSET_MASK) == 0); 2614 2613 Assert((pRange->Core.KeyLast & PAGE_OFFSET_MASK) == PAGE_OFFSET_MASK); 2615 # endif2614 # endif 2616 2615 2617 2616 /* … … 2634 2633 return VINF_SUCCESS; 2635 2634 } 2636 # endif /* !IEM_VERIFICATION_MODE_FULL */2635 # endif /* !IEM_VERIFICATION_MODE_FULL */ 2637 2636 2638 2637 … … 2660 2659 * Lookup the context range node the page belongs to. 2661 2660 */ 2662 # ifdef VBOX_STRICT2661 # ifdef VBOX_STRICT 2663 2662 /* Can't lock IOM here due to potential deadlocks in the VGA device; not safe to access. */ 2664 2663 PIOMMMIORANGE pRange = iomMMIOGetRangeUnsafe(pVM, pVCpu, GCPhys); … … 2667 2666 Assert((pRange->GCPhys & PAGE_OFFSET_MASK) == 0); 2668 2667 Assert((pRange->Core.KeyLast & PAGE_OFFSET_MASK) == PAGE_OFFSET_MASK); 2669 # endif2668 # endif 2670 2669 2671 2670 /* … … 2678 2677 AssertRC(rc); 2679 2678 2680 # ifdef VBOX_STRICT2679 # ifdef VBOX_STRICT 2681 2680 if (!VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3)) 2682 2681 { … … 2693 2692 } 2694 2693 } 2695 # endif2694 # endif 2696 2695 return rc; 2697 2696 } -
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r55863 r56080 4779 4779 if (IoExitInfo.n.u1STR) 4780 4780 { 4781 #ifdef VBOX_WITH_2ND_IEM_STEP 4782 /* INS/OUTS - I/O String instruction. */ 4783 /** @todo Huh? why can't we use the segment prefix information given by AMD-V 4784 * in EXITINFO1? Investigate once this thing is up and running. */ 4785 Log4(("CS:RIP=%04x:%08RX64 %#06x/%u %c str\n", pCtx->cs.Sel, pCtx->rip, IoExitInfo.n.u16Port, cbValue, 4786 IoExitInfo.n.u1Type == SVM_IOIO_WRITE ? 'w' : 'r')); 4787 AssertReturn(pCtx->dx == IoExitInfo.n.u16Port, VERR_SVM_IPE_2); 4788 static IEMMODE const s_aenmAddrMode[8] = 4789 { 4790 (IEMMODE)-1, IEMMODE_16BIT, IEMMODE_32BIT, (IEMMODE)-1, IEMMODE_64BIT, (IEMMODE)-1, (IEMMODE)-1, (IEMMODE)-1 4791 }; 4792 IEMMODE enmAddrMode = s_aenmAddrMode[(IoExitInfo.u >> 7) & 0x7]; 4793 if (enmAddrMode != (IEMMODE)-1) 4794 { 4795 uint64_t cbInstr = pVmcb->ctrl.u64ExitInfo2 - pCtx->rip; 4796 if (cbInstr <= 15 && cbInstr >= 2) 4797 { 4798 if (IoExitInfo.n.u1Type == SVM_IOIO_WRITE) 4799 { 4800 if (pVM->hm.s.svm.u32Features & AMD_CPUID_SVM_FEATURE_EDX_NRIP_SAVE) 4801 rcStrict = IEMExecStringIoWrite(pVCpu, cbValue, enmAddrMode, IoExitInfo.n.u1REP, (uint8_t)cbInstr, 4802 IoExitInfo.n.u3SEG); 4803 else 4804 rcStrict = IEMExecOne(pVCpu); 4805 STAM_COUNTER_INC(&pVCpu->hm.s.StatExitIOStringWrite); 4806 } 4807 else 4808 { 4809 AssertMsg(IoExitInfo.n.u3SEG == X86_SREG_ES /*=0*/, ("%#x\n", IoExitInfo.n.u3SEG)); 4810 rcStrict = IEMExecStringIoRead(pVCpu, cbValue, enmAddrMode, IoExitInfo.n.u1REP, (uint8_t)cbInstr); 4811 STAM_COUNTER_INC(&pVCpu->hm.s.StatExitIOStringRead); 4812 } 4813 } 4814 else 4815 { 4816 AssertMsgFailed(("rip=%RX64 nrip=%#RX64 cbInstr=%#RX64\n", pCtx->rip, pVmcb->ctrl.u64ExitInfo2, cbInstr)); 4817 rcStrict = IEMExecOne(pVCpu); 4818 } 4819 } 4820 else 4821 { 4822 AssertMsgFailed(("IoExitInfo=%RX64\n", IoExitInfo.u)); 4823 rcStrict = IEMExecOne(pVCpu); 4824 } 4825 4826 #else 4781 4827 /* INS/OUTS - I/O String instruction. */ 4782 4828 PDISCPUSTATE pDis = &pVCpu->hm.s.DisState; … … 4803 4849 else 4804 4850 rcStrict = VINF_EM_RAW_EMULATE_INSTR; 4851 #endif 4805 4852 } 4806 4853 else … … 4820 4867 { 4821 4868 uint32_t u32Val = 0; 4822 4823 4869 rcStrict = IOMIOPortRead(pVM, pVCpu, IoExitInfo.n.u16Port, &u32Val, cbValue); 4824 4870 if (IOM_SUCCESS(rcStrict)) 4825 4871 { 4826 4872 /* Save result of I/O IN instr. in AL/AX/EAX. */ 4873 /** @todo r=bird: 32-bit op size should clear high bits of rax! */ 4827 4874 pCtx->eax = (pCtx->eax & ~uAndVal) | (u32Val & uAndVal); 4828 4875 } -
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r56048 r56080 11186 11186 if (fIOString) 11187 11187 { 11188 #if 0 /* Not yet ready. IEM gurus with debian 32-bit guest without NP (on ATA reads). See @bugref{5752#c158}*/11188 #ifdef VBOX_WITH_2ND_IEM_STEP /* This used to gurus with debian 32-bit guest without NP (on ATA reads). See @bugref{5752#c158}. Should work now. */ 11189 11189 /* 11190 11190 * INS/OUTS - I/O String instruction. -
trunk/src/VBox/VMM/VMMRC/IOMRC.cpp
r56072 r56080 27 27 #include <VBox/vmm/mm.h> 28 28 #include <VBox/vmm/em.h> 29 #include <VBox/vmm/iem.h> 29 30 #include <VBox/vmm/pgm.h> 30 31 #include <VBox/vmm/trpm.h> … … 40 41 #include <iprt/asm.h> 41 42 #include <iprt/string.h> 43 44 45 #ifdef VBOX_WITH_2ND_IEM_STEP 46 /** 47 * Converts disassembler mode to IEM mode. 48 * @return IEM CPU mode. 49 * @param enmDisMode Disassembler CPU mode. 50 */ 51 DECLINLINE(IEMMODE) iomDisModeToIemMode(DISCPUMODE enmDisMode) 52 { 53 switch (enmDisMode) 54 { 55 case DISCPUMODE_16BIT: return IEMMODE_16BIT; 56 case DISCPUMODE_32BIT: return IEMMODE_32BIT; 57 case DISCPUMODE_64BIT: return IEMMODE_64BIT; 58 default: 59 AssertFailed(); 60 return IEMMODE_32BIT; 61 } 62 } 63 #endif 42 64 43 65 … … 178 200 static VBOXSTRICTRC iomRCInterpretINS(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu) 179 201 { 202 #ifdef VBOX_WITH_2ND_IEM_STEP 203 uint8_t cbValue = pCpu->pCurInstr->uOpcode == OP_INSB ? 1 204 : pCpu->uOpMode == DISCPUMODE_16BIT ? 2 : 4; /* dword in both 32 & 64 bits mode */ 205 return IEMExecStringIoRead(pVCpu, 206 cbValue, 207 iomDisModeToIemMode((DISCPUMODE)pCpu->uCpuMode), 208 RT_BOOL(pCpu->fPrefix & (DISPREFIX_REPNE | DISPREFIX_REP)), 209 pCpu->cbInstr); 210 #else 180 211 /* 181 212 * Get port number directly from the register (no need to bother the … … 197 228 198 229 return IOMInterpretINSEx(pVM, pVCpu, pRegFrame, Port, pCpu->fPrefix, (DISCPUMODE)pCpu->uAddrMode, cb); 230 #endif 199 231 } 200 232 … … 222 254 static VBOXSTRICTRC iomRCInterpretOUTS(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu) 223 255 { 256 #ifdef VBOX_WITH_2ND_IEM_STEP 257 uint8_t cbValue = pCpu->pCurInstr->uOpcode == OP_OUTSB ? 1 258 : pCpu->uOpMode == DISCPUMODE_16BIT ? 2 : 4; /* dword in both 32 & 64 bits mode */ 259 return IEMExecStringIoWrite(pVCpu, 260 cbValue, 261 iomDisModeToIemMode((DISCPUMODE)pCpu->uCpuMode), 262 RT_BOOL(pCpu->fPrefix & (DISPREFIX_REPNE | DISPREFIX_REP)), 263 pCpu->cbInstr, 264 pCpu->fPrefix & DISPREFIX_SEG ? pCpu->idxSegPrefix : X86_SREG_DS); 265 #else 224 266 /* 225 267 * Get port number from the first parameter. … … 227 269 */ 228 270 uint64_t Port = 0; 229 unsigned cb;230 271 bool fRc = iomGetRegImmData(pCpu, &pCpu->Param1, pRegFrame, &Port, &cb); 231 272 AssertMsg(fRc, ("Failed to get reg/imm port number!\n")); NOREF(fRc); 273 unsigned cb; 232 274 if (pCpu->pCurInstr->uOpcode == OP_OUTSB) 233 275 cb = 1; … … 243 285 244 286 return IOMInterpretOUTSEx(pVM, pVCpu, pRegFrame, Port, pCpu->fPrefix, (DISCPUMODE)pCpu->uAddrMode, cb); 287 #endif 245 288 } 246 289
Note:
See TracChangeset
for help on using the changeset viewer.