~ubuntu-branches/ubuntu/vivid/virtualbox-ose/vivid

« back to all changes in this revision

Viewing changes to src/VBox/VMM/CPUM.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2010-03-11 17:16:37 UTC
  • mfrom: (0.3.4 upstream) (0.4.8 sid)
  • Revision ID: james.westby@ubuntu.com-20100311171637-43z64ia3ccpj8vqn
Tags: 3.1.4-dfsg-2ubuntu1
* Merge from Debian unstable (LP: #528561), remaining changes:
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
  - Replace *-source packages with transitional packages for *-dkms
* Fix crash in vboxvideo_drm with kernel 2.6.33 / backported drm code
  (LP: #535297)
* Add a list of linux-headers packages to the apport hook
* Update debian/patches/u02-lp-integration.dpatch with a
  DEP-3 compliant header
* Add ${misc:Depends} to virtualbox-ose-source and virtualbox-ose-guest-source
  Depends

Show diffs side-by-side

added added

removed removed

Lines of Context:
103
103
static int cpumR3CpuIdInit(PVM pVM);
104
104
static DECLCALLBACK(int)  cpumR3LiveExec(PVM pVM, PSSMHANDLE pSSM, uint32_t uPass);
105
105
static DECLCALLBACK(int)  cpumR3SaveExec(PVM pVM, PSSMHANDLE pSSM);
 
106
static DECLCALLBACK(int)  cpumR3LoadPrep(PVM pVM, PSSMHANDLE pSSM);
106
107
static DECLCALLBACK(int)  cpumR3LoadExec(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
 
108
static DECLCALLBACK(int)  cpumR3LoadDone(PVM pVM, PSSMHANDLE pSSM);
107
109
static DECLCALLBACK(void) cpumR3InfoAll(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
108
110
static DECLCALLBACK(void) cpumR3InfoGuest(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
109
111
static DECLCALLBACK(void) cpumR3InfoGuestInstr(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
213
215
    int rc = SSMR3RegisterInternal(pVM, "cpum", 1, CPUM_SAVED_STATE_VERSION, sizeof(CPUM),
214
216
                                   NULL, cpumR3LiveExec, NULL,
215
217
                                   NULL, cpumR3SaveExec, NULL,
216
 
                                   NULL, cpumR3LoadExec, NULL);
 
218
                                   cpumR3LoadPrep, cpumR3LoadExec, cpumR3LoadDone);
217
219
    if (RT_FAILURE(rc))
218
220
        return rc;
219
221
 
1074
1076
            if (fStrictCpuIdChecks) \
1075
1077
                return SSMR3SetLoadError(pSSM, VERR_SSM_LOAD_CPUID_MISMATCH, RT_SRC_POS, \
1076
1078
                                         N_(#bit " mismatch: host=%d saved=%d"), \
1077
 
                                         aHostRaw##set [1].reg & (bit), aRaw##set [1].reg & (bit) ); \
 
1079
                                         !!(aHostRaw##set [1].reg & (bit)), !!(aRaw##set [1].reg & (bit)) ); \
1078
1080
            LogRel(("CPUM: " #bit" differs: host=%d saved=%d\n", \
1079
 
                    aHostRaw##set [1].reg & (bit), aRaw##set [1].reg & (bit) )); \
 
1081
                    !!(aHostRaw##set [1].reg & (bit)), !!(aRaw##set [1].reg & (bit)) )); \
1080
1082
        } \
1081
1083
    } while (0)
1082
1084
#define CPUID_RAW_FEATURE_WRN(set, reg, bit) \
1083
1085
    do { \
1084
1086
        if ((aHostRaw##set [1].reg & bit) != (aRaw##set [1].reg & bit)) \
1085
1087
            LogRel(("CPUM: " #bit" differs: host=%d saved=%d\n", \
1086
 
                    aHostRaw##set [1].reg & (bit), aRaw##set [1].reg & (bit) )); \
 
1088
                    !!(aHostRaw##set [1].reg & (bit)), !!(aRaw##set [1].reg & (bit)) )); \
1087
1089
    } while (0)
1088
1090
#define CPUID_RAW_FEATURE_IGN(set, reg, bit) do { } while (0)
1089
1091
 
1304
1306
     * This can be skipped.
1305
1307
     */
1306
1308
    bool fStrictCpuIdChecks;
1307
 
    CFGMR3QueryBoolDef(CFGMR3GetChild(CFGMR3GetRoot(pVM), "CPUM"), "StrictCpuIdChecks", &fStrictCpuIdChecks, false);
 
1309
    CFGMR3QueryBoolDef(CFGMR3GetChild(CFGMR3GetRoot(pVM), "CPUM"), "StrictCpuIdChecks", &fStrictCpuIdChecks, true);
1308
1310
 
1309
1311
 
1310
1312
 
1866
1868
 
1867
1869
 
1868
1870
/**
1869
 
 * Execute state load operation.
1870
 
 *
1871
 
 * @returns VBox status code.
1872
 
 * @param   pVM             VM Handle.
1873
 
 * @param   pSSM            SSM operation handle.
1874
 
 * @param   uVersion        Data layout version.
1875
 
 * @param   uPass           The data pass.
 
1871
 * @copydoc FNSSMINTLOADPREP
 
1872
 */
 
1873
static DECLCALLBACK(int) cpumR3LoadPrep(PVM pVM, PSSMHANDLE pSSM)
 
1874
{
 
1875
    pVM->cpum.s.fPendingRestore = true;
 
1876
    return VINF_SUCCESS;
 
1877
}
 
1878
 
 
1879
 
 
1880
/**
 
1881
 * @copydoc FNSSMINTLOADEXEC
1876
1882
 */
1877
1883
static DECLCALLBACK(int) cpumR3LoadExec(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
1878
1884
{
1951
1957
        }
1952
1958
    }
1953
1959
 
 
1960
    pVM->cpum.s.fPendingRestore = false;
 
1961
 
1954
1962
    /*
1955
1963
     * Guest CPUIDs.
1956
1964
     */
2072
2080
 
2073
2081
 
2074
2082
/**
 
2083
 * @copydoc FNSSMINTLOADPREP
 
2084
 */
 
2085
static DECLCALLBACK(int) cpumR3LoadDone(PVM pVM, PSSMHANDLE pSSM)
 
2086
{
 
2087
    if (RT_FAILURE(SSMR3HandleGetStatus(pSSM)))
 
2088
        return VINF_SUCCESS;
 
2089
 
 
2090
    /* just check this since we can. */ /** @todo Add a SSM unit flag for indicating that it's mandatory during a restore.  */
 
2091
    if (pVM->cpum.s.fPendingRestore)
 
2092
    {
 
2093
        LogRel(("CPUM: Missing state!\n"));
 
2094
        return VERR_INTERNAL_ERROR_2;
 
2095
    }
 
2096
 
 
2097
    return VINF_SUCCESS;
 
2098
}
 
2099
 
 
2100
 
 
2101
/**
 
2102
 * Checks if the CPUM state restore is still pending.
 
2103
 *
 
2104
 * @returns true / false.
 
2105
 * @param   pVM                 The VM handle.
 
2106
 */
 
2107
VMMDECL(bool) CPUMR3IsStateRestorePending(PVM pVM)
 
2108
{
 
2109
    return pVM->cpum.s.fPendingRestore;
 
2110
}
 
2111
 
 
2112
 
 
2113
/**
2075
2114
 * Formats the EFLAGS value into mnemonics.
2076
2115
 *
2077
2116
 * @param   pszEFlags   Where to write the mnemonics. (Assumes sufficient buffer space.)
3461
3500
 */
3462
3501
VMMR3DECL(void) CPUMR3SaveEntryCtx(PVM pVM)
3463
3502
{
3464
 
    /* @todo SMP support!! */
 
3503
    /** @todo SMP support!! */
3465
3504
    pVM->cpum.s.GuestEntry = *CPUMQueryGuestCtxPtr(VMMGetCpu(pVM));
3466
3505
}
3467
3506