Changeset 45908 in vbox for trunk/src/VBox/VMM
- Timestamp:
- May 6, 2013 12:59:37 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r45906 r45908 4727 4727 static int hmR0VmxSaveGuestCR0(PVMCPU pVCpu, PCPUMCTX pMixedCtx) 4728 4728 { 4729 int rc = VINF_SUCCESS;4730 4729 if (!(pVCpu->hm.s.vmx.fUpdatedGuestState & HMVMX_UPDATED_GUEST_CR0)) 4731 4730 { 4732 4731 uint32_t uVal = 0; 4732 int rc = VMXReadVmcs32(VMX_VMCS_GUEST_CR0, &uVal); 4733 AssertRCReturn(rc, rc); 4733 4734 uint32_t uShadow = 0; 4734 rc = VMXReadVmcs32(VMX_VMCS_GUEST_CR0, &uVal); 4735 rc |= VMXReadVmcs32(VMX_VMCS_CTRL_CR0_READ_SHADOW, &uShadow); 4735 rc = VMXReadVmcs32(VMX_VMCS_CTRL_CR0_READ_SHADOW, &uShadow); 4736 4736 AssertRCReturn(rc, rc); 4737 4737 4738 uVal = (uShadow & pVCpu->hm.s.vmx.cr0_mask) | (uVal & ~pVCpu->hm.s.vmx.cr0_mask); 4738 4739 CPUMSetGuestCR0(pVCpu, uVal); 4739 4740 pVCpu->hm.s.vmx.fUpdatedGuestState |= HMVMX_UPDATED_GUEST_CR0; 4740 4741 } 4741 return rc;4742 return VINF_SUCCESS; 4742 4743 } 4743 4744 … … 4837 4838 static int hmR0VmxSaveGuestRflags(PVMCPU pVCpu, PCPUMCTX pMixedCtx) 4838 4839 { 4839 int rc = VINF_SUCCESS;4840 4840 if (!(pVCpu->hm.s.vmx.fUpdatedGuestState & HMVMX_UPDATED_GUEST_RFLAGS)) 4841 4841 { 4842 4842 uint32_t uVal = 0; 4843 rc = VMXReadVmcs32(VMX_VMCS_GUEST_RFLAGS, &uVal);4843 int rc = VMXReadVmcs32(VMX_VMCS_GUEST_RFLAGS, &uVal); 4844 4844 AssertRCReturn(rc, rc); 4845 4845 pMixedCtx->eflags.u32 = uVal; … … 4857 4857 pVCpu->hm.s.vmx.fUpdatedGuestState |= HMVMX_UPDATED_GUEST_RFLAGS; 4858 4858 } 4859 return rc;4859 return VINF_SUCCESS; 4860 4860 } 4861 4861 … … 5137 5137 */ 5138 5138 DECLINLINE(int) hmR0VmxReadSegmentReg(PVMCPU pVCpu, uint32_t idxSel, uint32_t idxLimit, uint32_t idxBase, uint32_t idxAccess, 5139 PCPUMSELREG pSelReg)5139 PCPUMSELREG pSelReg) 5140 5140 { 5141 5141 uint32_t u32Val = 0; 5142 5142 int rc = VMXReadVmcs32(idxSel, &u32Val); 5143 AssertRCReturn(rc, rc); 5143 5144 pSelReg->Sel = (uint16_t)u32Val; 5144 5145 pSelReg->ValidSel = (uint16_t)u32Val; 5145 5146 pSelReg->fFlags = CPUMSELREG_FLAGS_VALID; 5146 5147 5147 rc |= VMXReadVmcs32(idxLimit, &u32Val); 5148 rc = VMXReadVmcs32(idxLimit, &u32Val); 5149 AssertRCReturn(rc, rc); 5148 5150 pSelReg->u32Limit = u32Val; 5149 5151 5150 5152 RTGCUINTREG uGCVal = 0; 5151 rc |= VMXReadVmcsGstNByIdxVal(idxBase, &uGCVal); 5153 rc = VMXReadVmcsGstNByIdxVal(idxBase, &uGCVal); 5154 AssertRCReturn(rc, rc); 5152 5155 pSelReg->u64Base = uGCVal; 5153 5156 5154 rc |= VMXReadVmcs32(idxAccess, &u32Val); 5157 rc = VMXReadVmcs32(idxAccess, &u32Val); 5158 AssertRCReturn(rc, rc); 5155 5159 pSelReg->Attr.u = u32Val; 5156 AssertRCReturn(rc, rc);5157 5160 5158 5161 /* … … 5168 5171 pSelReg->Attr.u = HMVMX_SEL_UNUSABLE; 5169 5172 } 5170 return rc;5173 return VINF_SUCCESS; 5171 5174 } 5172 5175 … … 5195 5198 static int hmR0VmxSaveGuestSegmentRegs(PVMCPU pVCpu, PCPUMCTX pMixedCtx) 5196 5199 { 5197 int rc = VINF_SUCCESS;5198 5199 5200 /* Guest segment registers. */ 5200 5201 if (!(pVCpu->hm.s.vmx.fUpdatedGuestState & HMVMX_UPDATED_GUEST_SEGMENT_REGS)) 5201 5202 { 5202 rc = hmR0VmxSaveGuestCR0(pVCpu, pMixedCtx); 5203 rc |= VMXLOCAL_READ_SEG(CS, cs); 5204 rc |= VMXLOCAL_READ_SEG(SS, ss); 5205 rc |= VMXLOCAL_READ_SEG(DS, ds); 5206 rc |= VMXLOCAL_READ_SEG(ES, es); 5207 rc |= VMXLOCAL_READ_SEG(FS, fs); 5208 rc |= VMXLOCAL_READ_SEG(GS, gs); 5203 int rc = hmR0VmxSaveGuestCR0(pVCpu, pMixedCtx); 5204 AssertRCReturn(rc, rc); 5205 rc = VMXLOCAL_READ_SEG(CS, cs); 5206 AssertRCReturn(rc, rc); 5207 rc = VMXLOCAL_READ_SEG(SS, ss); 5208 AssertRCReturn(rc, rc); 5209 rc = VMXLOCAL_READ_SEG(DS, ds); 5210 AssertRCReturn(rc, rc); 5211 rc = VMXLOCAL_READ_SEG(ES, es); 5212 AssertRCReturn(rc, rc); 5213 rc = VMXLOCAL_READ_SEG(FS, fs); 5214 AssertRCReturn(rc, rc); 5215 rc = VMXLOCAL_READ_SEG(GS, gs); 5209 5216 AssertRCReturn(rc, rc); 5210 5217 … … 5222 5229 } 5223 5230 5224 return rc;5231 return VINF_SUCCESS; 5225 5232 } 5226 5233 … … 7629 7636 /* EMInterpretRdmsr() requires CR0, Eflags and SS segment register. */ 7630 7637 int rc = hmR0VmxSaveGuestCR0(pVCpu, pMixedCtx); 7631 rc |= hmR0VmxSaveGuestRflags(pVCpu, pMixedCtx); 7632 rc |= hmR0VmxSaveGuestSegmentRegs(pVCpu, pMixedCtx); 7638 AssertRCReturn(rc, rc); 7639 rc = hmR0VmxSaveGuestRflags(pVCpu, pMixedCtx); 7640 AssertRCReturn(rc, rc); 7641 rc = hmR0VmxSaveGuestSegmentRegs(pVCpu, pMixedCtx); 7633 7642 AssertRCReturn(rc, rc); 7634 7643
Note:
See TracChangeset
for help on using the changeset viewer.