VirtualBox

Changeset 2224 in vbox for trunk


Ignore:
Timestamp:
Apr 19, 2007 1:18:14 PM (18 years ago)
Author:
vboxsync
Message:

In some situations the guest state would not be synced.

Location:
trunk/src/VBox/VMM/VMMR0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp

    r2218 r2224  
    509509    SVM_VMCB   *pVMCB;
    510510    bool        fForceTLBFlush = false;
     511    bool        fGuestStateSynced = false;
    511512
    512513    STAM_PROFILE_ADV_START(&pVM->hwaccm.s.StatEntry, x);
     
    581582        goto end;
    582583    }
     584    fGuestStateSynced = true;
    583585
    584586    /* All done! Let's start VM execution. */
     
    13471349    }
    13481350
    1349     /* Remaining guest CPU context: TR, IDTR, GDTR, LDTR. */
    1350     SVM_READ_SELREG(LDTR, ldtr);
    1351     SVM_READ_SELREG(TR, tr);
    1352 
    1353     pCtx->gdtr.cbGdt        = pVMCB->guest.GDTR.u32Limit;
    1354     pCtx->gdtr.pGdt         = pVMCB->guest.GDTR.u64Base;
    1355 
    1356     pCtx->idtr.cbIdt        = pVMCB->guest.IDTR.u32Limit;
    1357     pCtx->idtr.pIdt         = pVMCB->guest.IDTR.u64Base;
    1358 
    1359     /*
    1360      * System MSRs
    1361      */
    1362     pCtx->SysEnter.cs       = pVMCB->guest.u64SysEnterCS;
    1363     pCtx->SysEnter.eip      = pVMCB->guest.u64SysEnterEIP;
    1364     pCtx->SysEnter.esp      = pVMCB->guest.u64SysEnterESP;
     1351end:
     1352    if (fGuestStateSynced)
     1353    {
     1354        /* Remaining guest CPU context: TR, IDTR, GDTR, LDTR. */
     1355        SVM_READ_SELREG(LDTR, ldtr);
     1356        SVM_READ_SELREG(TR, tr);
     1357
     1358        pCtx->gdtr.cbGdt        = pVMCB->guest.GDTR.u32Limit;
     1359        pCtx->gdtr.pGdt         = pVMCB->guest.GDTR.u64Base;
     1360
     1361        pCtx->idtr.cbIdt        = pVMCB->guest.IDTR.u32Limit;
     1362        pCtx->idtr.pIdt         = pVMCB->guest.IDTR.u64Base;
     1363
     1364        /*
     1365         * System MSRs
     1366         */
     1367        pCtx->SysEnter.cs       = pVMCB->guest.u64SysEnterCS;
     1368        pCtx->SysEnter.eip      = pVMCB->guest.u64SysEnterEIP;
     1369        pCtx->SysEnter.esp      = pVMCB->guest.u64SysEnterESP;
     1370    }
    13651371
    13661372    /* Signal changes for the recompiler. */
    13671373    CPUMSetChangedFlags(pVM, CPUM_CHANGED_SYSENTER_MSR | CPUM_CHANGED_LDTR | CPUM_CHANGED_GDTR | CPUM_CHANGED_IDTR | CPUM_CHANGED_TR | CPUM_CHANGED_HIDDEN_SEL_REGS);
    1368 
    1369 end:
    13701374
    13711375    /* If we executed vmrun and an external irq was pending, then we don't have to do a full sync the next time. */
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp

    r2218 r2224  
    780780    RTGCUINTPTR intInfo = 0; /* shut up buggy gcc 4 */
    781781    RTGCUINTPTR errCode, instrInfo, uInterruptState;
     782    bool        fGuestStateSynced = false;
    782783
    783784    Log2(("\nE"));
     
    930931        goto end;
    931932    }
     933    fGuestStateSynced = true;
    932934
    933935    /* Non-register state Guest Context */
     
    16321634    }
    16331635
    1634     /* Remaining guest CPU context: TR, IDTR, GDTR, LDTR. */
    1635     VMX_READ_SELREG(LDTR, ldtr);
    1636     VMX_READ_SELREG(TR, tr);
    1637 
    1638     VMXReadVMCS(VMX_VMCS_GUEST_GDTR_LIMIT,       &val);
    1639     pCtx->gdtr.cbGdt        = val;
    1640     VMXReadVMCS(VMX_VMCS_GUEST_GDTR_BASE,        &val);
    1641     pCtx->gdtr.pGdt         = val;
    1642 
    1643     VMXReadVMCS(VMX_VMCS_GUEST_IDTR_LIMIT,       &val);
    1644     pCtx->idtr.cbIdt        = val;
    1645     VMXReadVMCS(VMX_VMCS_GUEST_IDTR_BASE,        &val);
    1646     pCtx->idtr.pIdt         = val;
    1647 
    1648     /*
    1649      * System MSRs
    1650      */
    1651     VMXReadVMCS(VMX_VMCS_GUEST_SYSENTER_CS,      &val);
    1652     pCtx->SysEnter.cs       = val;
    1653     VMXReadVMCS(VMX_VMCS_GUEST_SYSENTER_EIP,     &val);
    1654     pCtx->SysEnter.eip      = val;
    1655     VMXReadVMCS(VMX_VMCS_GUEST_SYSENTER_ESP,     &val);
    1656     pCtx->SysEnter.esp      = val;
    1657 
    1658     /* Signal changes for the recompiler. */
    1659     CPUMSetChangedFlags(pVM, CPUM_CHANGED_SYSENTER_MSR | CPUM_CHANGED_LDTR | CPUM_CHANGED_GDTR | CPUM_CHANGED_IDTR | CPUM_CHANGED_TR | CPUM_CHANGED_HIDDEN_SEL_REGS);
     1636    /** Note: the guest state isn't entirely synced back at this stage. */
    16601637
    16611638    /* Investigate why there was a VM-exit. (part 2) */
     
    17551732    }
    17561733end:
     1734    if (fGuestStateSynced)
     1735    {
     1736        /* Remaining guest CPU context: TR, IDTR, GDTR, LDTR. */
     1737        VMX_READ_SELREG(LDTR, ldtr);
     1738        VMX_READ_SELREG(TR, tr);
     1739
     1740        VMXReadVMCS(VMX_VMCS_GUEST_GDTR_LIMIT,       &val);
     1741        pCtx->gdtr.cbGdt        = val;
     1742        VMXReadVMCS(VMX_VMCS_GUEST_GDTR_BASE,        &val);
     1743        pCtx->gdtr.pGdt         = val;
     1744
     1745        VMXReadVMCS(VMX_VMCS_GUEST_IDTR_LIMIT,       &val);
     1746        pCtx->idtr.cbIdt        = val;
     1747        VMXReadVMCS(VMX_VMCS_GUEST_IDTR_BASE,        &val);
     1748        pCtx->idtr.pIdt         = val;
     1749
     1750        /*
     1751         * System MSRs
     1752         */
     1753        VMXReadVMCS(VMX_VMCS_GUEST_SYSENTER_CS,      &val);
     1754        pCtx->SysEnter.cs       = val;
     1755        VMXReadVMCS(VMX_VMCS_GUEST_SYSENTER_EIP,     &val);
     1756        pCtx->SysEnter.eip      = val;
     1757        VMXReadVMCS(VMX_VMCS_GUEST_SYSENTER_ESP,     &val);
     1758        pCtx->SysEnter.esp      = val;
     1759    }
     1760
     1761    /* Signal changes for the recompiler. */
     1762    CPUMSetChangedFlags(pVM, CPUM_CHANGED_SYSENTER_MSR | CPUM_CHANGED_LDTR | CPUM_CHANGED_GDTR | CPUM_CHANGED_IDTR | CPUM_CHANGED_TR | CPUM_CHANGED_HIDDEN_SEL_REGS);
    17571763
    17581764    /* If we executed vmlaunch/vmresume and an external irq was pending, then we don't have to do a full sync the next time. */
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