Changeset 72882 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Jul 4, 2018 3:19:44 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 123427
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/EMAll.cpp
r72877 r72882 2100 2100 2101 2101 /** 2102 * Interpret RDMSR2103 *2104 * @returns VBox status code.2105 * @param pVM The cross context VM structure.2106 * @param pVCpu The cross context virtual CPU structure.2107 * @param pRegFrame The register frame.2108 */2109 VMM_INT_DECL(int) EMInterpretRdmsr(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame)2110 {2111 NOREF(pVM);2112 2113 /* Get the current privilege level. */2114 if (CPUMGetGuestCPL(pVCpu) != 0)2115 {2116 Log4(("EM: Refuse RDMSR: CPL != 0\n"));2117 return VERR_EM_INTERPRETER; /* supervisor only */2118 }2119 2120 uint64_t uValue;2121 VBOXSTRICTRC rcStrict = CPUMQueryGuestMsr(pVCpu, pRegFrame->ecx, &uValue);2122 if (RT_UNLIKELY(rcStrict != VINF_SUCCESS))2123 {2124 Log4(("EM: Refuse RDMSR: rc=%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));2125 Assert(rcStrict == VERR_CPUM_RAISE_GP_0 || rcStrict == VERR_EM_INTERPRETER || rcStrict == VINF_CPUM_R3_MSR_READ);2126 return VERR_EM_INTERPRETER;2127 }2128 pRegFrame->rax = RT_LO_U32(uValue);2129 pRegFrame->rdx = RT_HI_U32(uValue);2130 LogFlow(("EMInterpretRdmsr %s (%x) -> %RX64\n", emMSRtoString(pRegFrame->ecx), pRegFrame->ecx, uValue));2131 return VINF_SUCCESS;2132 }2133 2134 2135 /**2136 2102 * Interpret DRx write. 2137 2103 * … … 4205 4171 Assert(!(pDis->fPrefix & DISPREFIX_REX)); 4206 4172 NOREF(pDis); NOREF(pvFault); NOREF(pcbSize); 4207 return EMInterpretRdmsr(pVM, pVCpu, pRegFrame); 4173 4174 /* Get the current privilege level. */ 4175 if (CPUMGetGuestCPL(pVCpu) != 0) 4176 { 4177 Log4(("EM: Refuse RDMSR: CPL != 0\n")); 4178 return VERR_EM_INTERPRETER; /* supervisor only */ 4179 } 4180 4181 uint64_t uValue; 4182 VBOXSTRICTRC rcStrict = CPUMQueryGuestMsr(pVCpu, pRegFrame->ecx, &uValue); 4183 if (RT_UNLIKELY(rcStrict != VINF_SUCCESS)) 4184 { 4185 Log4(("EM: Refuse RDMSR: rc=%Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); 4186 Assert(rcStrict == VERR_CPUM_RAISE_GP_0 || rcStrict == VERR_EM_INTERPRETER || rcStrict == VINF_CPUM_R3_MSR_READ); 4187 return VERR_EM_INTERPRETER; 4188 } 4189 pRegFrame->rax = RT_LO_U32(uValue); 4190 pRegFrame->rdx = RT_HI_U32(uValue); 4191 LogFlow(("EMInterpretRdmsr %s (%x) -> %RX64\n", emMSRtoString(pRegFrame->ecx), pRegFrame->ecx, uValue)); 4192 return VINF_SUCCESS; 4208 4193 } 4209 4194 -
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r72877 r72882 14999 14999 15000 15000 /** 15001 * Interface for HM and EM to emulate the WRMSR instruction.15001 * Interface for HM and EM to emulate the RDMSR instruction. 15002 15002 * 15003 15003 * @returns Strict VBox status code. … … 15007 15007 * @param cbInstr The instruction length in bytes. 15008 15008 * 15009 * @remarks Not all of the state needs to be synced in. Recommended 15010 * to include CPUMCTX_EXTRN_TSC_AUX, to avoid extra fetch call. 15009 * @remarks Not all of the state needs to be synced in. Requires RCX and 15010 * (currently) all MSRs. 15011 */ 15012 VMM_INT_DECL(VBOXSTRICTRC) IEMExecDecodedRdmsr(PVMCPU pVCpu, uint8_t cbInstr) 15013 { 15014 IEMEXEC_ASSERT_INSTR_LEN_RETURN(cbInstr, 2); 15015 IEM_CTX_ASSERT(pVCpu, IEM_CPUMCTX_EXTRN_EXEC_DECODED_NO_MEM_MASK | CPUMCTX_EXTRN_RCX | CPUMCTX_EXTRN_ALL_MSRS); 15016 15017 iemInitExec(pVCpu, false /*fBypassHandlers*/); 15018 VBOXSTRICTRC rcStrict = IEM_CIMPL_CALL_0(iemCImpl_rdmsr); 15019 Assert(!pVCpu->iem.s.cActiveMappings); 15020 return iemUninitExecAndFiddleStatusAndMaybeReenter(pVCpu, rcStrict); 15021 } 15022 15023 15024 /** 15025 * Interface for HM and EM to emulate the WRMSR instruction. 15026 * 15027 * @returns Strict VBox status code. 15028 * @retval VINF_IEM_RAISED_XCPT (VINF_EM_RESCHEDULE) if exception is raised. 15029 * 15030 * @param pVCpu The cross context virtual CPU structure. 15031 * @param cbInstr The instruction length in bytes. 15032 * 15033 * @remarks Not all of the state needs to be synced in. Requires RCX, RAX, RDX, 15034 * and (currently) all MSRs. 15011 15035 */ 15012 15036 VMM_INT_DECL(VBOXSTRICTRC) IEMExecDecodedWrmsr(PVMCPU pVCpu, uint8_t cbInstr) … … 15015 15039 IEM_CTX_ASSERT(pVCpu, IEM_CPUMCTX_EXTRN_EXEC_DECODED_NO_MEM_MASK 15016 15040 | CPUMCTX_EXTRN_RCX | CPUMCTX_EXTRN_RAX | CPUMCTX_EXTRN_RDX | CPUMCTX_EXTRN_ALL_MSRS); 15017 //CPUMCTX_EXTRN_RSP15018 15041 15019 15042 iemInitExec(pVCpu, false /*fBypassHandlers*/); -
trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp.h
r72866 r72882 6235 6235 #endif 6236 6236 6237 /** @todo make CPUMAllMsrs.cpp import the necessary MSR state. */ 6237 6238 IEM_CTX_IMPORT_RET(pVCpu, CPUMCTX_EXTRN_ALL_MSRS); 6238 6239 … … 6242 6243 pVCpu->cpum.GstCtx.rax = uValue.s.Lo; 6243 6244 pVCpu->cpum.GstCtx.rdx = uValue.s.Hi; 6245 pVCpu->cpum.GstCtx.fExtrn &= ~(CPUMCTX_EXTRN_RAX | CPUMCTX_EXTRN_RDX); 6244 6246 6245 6247 iemRegAddToRipAndClearRF(pVCpu, cbInstr); … … 6304 6306 #endif 6305 6307 6308 /** @todo make CPUMAllMsrs.cpp import the necessary MSR state. */ 6306 6309 IEM_CTX_IMPORT_RET(pVCpu, CPUMCTX_EXTRN_ALL_MSRS); 6307 6310 … … 6803 6806 } 6804 6807 6808 /** @todo make CPUMGetGuestCpuId import any necessary MSR state. */ 6805 6809 IEM_CTX_IMPORT_RET(pVCpu, CPUMCTX_EXTRN_ALL_MSRS); 6806 6810 CPUMGetGuestCpuId(pVCpu, pVCpu->cpum.GstCtx.eax, pVCpu->cpum.GstCtx.ecx, &pVCpu->cpum.GstCtx.eax, &pVCpu->cpum.GstCtx.ebx, &pVCpu->cpum.GstCtx.ecx, &pVCpu->cpum.GstCtx.edx);
Note:
See TracChangeset
for help on using the changeset viewer.