VirtualBox

Changeset 74697 in vbox for trunk


Ignore:
Timestamp:
Oct 9, 2018 6:32:17 AM (6 years ago)
Author:
vboxsync
Message:

VMM/IEM: Nested VMX: bugref:9180 Added VMX non-root mode CR0 guest/host masking for SMSW.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp.h

    r74693 r74697  
    52745274
    52755275/**
    5276  * Implements smsw GReg
     5276 * Implements smsw GReg.
    52775277 *
    52785278 * @param   iGReg           The general register to store the CRx value in.
     
    52825282{
    52835283    IEM_SVM_CHECK_READ_CR0_INTERCEPT(pVCpu, 0 /* uExitInfo1 */, 0 /* uExitInfo2 */);
    5284     /** @todo NSTVMX: SMSW CR0 masking. */
     5284
     5285    uint64_t u64GuestCr0 = pVCpu->cpum.GstCtx.cr0;
     5286#ifdef VBOX_WITH_NESTED_HWVIRT_VMX
     5287    if (IEM_VMX_IS_NON_ROOT_MODE(pVCpu))
     5288        u64GuestCr0 = iemVmxMaskCr0CR4(pVCpu, 0 /* iCrReg */, u64GuestCr0);
     5289#endif
    52855290
    52865291    switch (enmEffOpSize)
     
    52885293        case IEMMODE_16BIT:
    52895294            if (IEM_GET_TARGET_CPU(pVCpu) > IEMTARGETCPU_386)
    5290                 *(uint16_t *)iemGRegRef(pVCpu, iGReg) = (uint16_t)pVCpu->cpum.GstCtx.cr0;
     5295                *(uint16_t *)iemGRegRef(pVCpu, iGReg) = (uint16_t)u64GuestCr0;
    52915296            else if (IEM_GET_TARGET_CPU(pVCpu) >= IEMTARGETCPU_386)
    5292                 *(uint16_t *)iemGRegRef(pVCpu, iGReg) = (uint16_t)pVCpu->cpum.GstCtx.cr0 | 0xffe0;
     5297                *(uint16_t *)iemGRegRef(pVCpu, iGReg) = (uint16_t)u64GuestCr0 | 0xffe0;
    52935298            else
    5294                 *(uint16_t *)iemGRegRef(pVCpu, iGReg) = (uint16_t)pVCpu->cpum.GstCtx.cr0 | 0xfff0;
     5299                *(uint16_t *)iemGRegRef(pVCpu, iGReg) = (uint16_t)u64GuestCr0 | 0xfff0;
    52955300            break;
    52965301
    52975302        case IEMMODE_32BIT:
    5298             *(uint64_t *)iemGRegRef(pVCpu, iGReg) = (uint32_t)pVCpu->cpum.GstCtx.cr0;
     5303            *(uint64_t *)iemGRegRef(pVCpu, iGReg) = (uint32_t)u64GuestCr0;
    52995304            break;
    53005305
    53015306        case IEMMODE_64BIT:
    5302             *(uint64_t *)iemGRegRef(pVCpu, iGReg) = pVCpu->cpum.GstCtx.cr0;
     5307            *(uint64_t *)iemGRegRef(pVCpu, iGReg) = u64GuestCr0;
    53035308            break;
    53045309
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette