VirtualBox

Changeset 10502 in vbox


Ignore:
Timestamp:
Jul 11, 2008 9:31:15 AM (17 years ago)
Author:
vboxsync
Message:

Take precautions for being rescheduled to a different cpu due to long jumps to ring 3. (affects AMD-V only)

Location:
trunk/src/VBox/VMM
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/HWACCMInternal.h

    r10489 r10502  
    396396
    397397#ifdef VBOX_STRICT
     398/**
     399 * Returns the cpu structure for the current cpu.
     400 * Keep in mind that there is no guarantee it will stay the same (long jumps to ring 3!!!).
     401 *
     402 * @returns cpu structure pointer
     403 * @param   pVM         The VM to operate on.
     404 */
     405HWACCMR0DECL(PHWACCM_CPUINFO) HWACCMR0GetCurrentCpu();
     406
    398407HWACCMR0DECL(void) HWACCMDumpRegs(PCPUMCTX pCtx);
    399408HWACCMR0DECL(void) HWACCMR0DumpDescriptor(PX86DESCHC  Desc, RTSEL Sel, const char *pszMsg);
     
    411420HWACCMR0DECL(int) HWACCMR0DummyTermVM(PVM pVM);
    412421HWACCMR0DECL(int) HWACCMR0DummySetupVM(PVM pVM);
    413 HWACCMR0DECL(int) HWACCMR0DummyRunGuestCode(PVM pVM, CPUMCTX *pCtx, PHWACCM_CPUINFO pCpu);
     422HWACCMR0DECL(int) HWACCMR0DummyRunGuestCode(PVM pVM, CPUMCTX *pCtx);
    414423HWACCMR0DECL(int) HWACCMR0DummySaveHostState(PVM pVM);
    415424HWACCMR0DECL(int) HWACCMR0DummyLoadGuestState(PVM pVM, CPUMCTX *pCtx);
  • trunk/src/VBox/VMM/VMMR0/HWACCMR0.cpp

    r10489 r10502  
    6767    DECLR0CALLBACKMEMBER(int, pfnSaveHostState,(PVM pVM));
    6868    DECLR0CALLBACKMEMBER(int, pfnLoadGuestState,(PVM pVM, CPUMCTX *pCtx));
    69     DECLR0CALLBACKMEMBER(int, pfnRunGuestCode,(PVM pVM, CPUMCTX *pCtx, PHWACCM_CPUINFO pCpu));
     69    DECLR0CALLBACKMEMBER(int, pfnRunGuestCode,(PVM pVM, CPUMCTX *pCtx));
    7070    DECLR0CALLBACKMEMBER(int, pfnEnableCpu, (PHWACCM_CPUINFO pCpu, PVM pVM, void *pvPageCpu, RTHCPHYS pPageCpuPhys));
    7171    DECLR0CALLBACKMEMBER(int, pfnDisableCpu, (PHWACCM_CPUINFO pCpu, void *pvPageCpu, RTHCPHYS pPageCpuPhys));
     
    795795
    796796    Assert(!VM_FF_ISPENDING(pVM, VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL));
     797    Assert(HWACCMR0Globals.aCpuInfo[idCpu].fConfigured);
    797798
    798799    rc = CPUMQueryGuestCtxPtr(pVM, &pCtx);
     
    800801        return rc;
    801802
    802     return HWACCMR0Globals.pfnRunGuestCode(pVM, pCtx, &HWACCMR0Globals.aCpuInfo[idCpu]);
    803 }
    804 
     803    return HWACCMR0Globals.pfnRunGuestCode(pVM, pCtx);
     804}
     805
     806/**
     807 * Returns the cpu structure for the current cpu.
     808 * Keep in mind that there is no guarantee it will stay the same (long jumps to ring 3!!!).
     809 *
     810 * @returns cpu structure pointer
     811 * @param   pVM         The VM to operate on.
     812 */
     813HWACCMR0DECL(PHWACCM_CPUINFO) HWACCMR0GetCurrentCpu()
     814{
     815    RTCPUID  idCpu = RTMpCpuId();
     816
     817    return &HWACCMR0Globals.aCpuInfo[idCpu];
     818}
    805819
    806820#ifdef VBOX_STRICT
     
    10471061}
    10481062
    1049 HWACCMR0DECL(int) HWACCMR0DummyRunGuestCode(PVM pVM, CPUMCTX *pCtx, PHWACCM_CPUINFO pCpu)
     1063HWACCMR0DECL(int) HWACCMR0DummyRunGuestCode(PVM pVM, CPUMCTX *pCtx)
    10501064{
    10511065    return VINF_SUCCESS;
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp

    r10500 r10502  
    765765 * @param   pVM         The VM to operate on.
    766766 * @param   pCtx        Guest context
    767  * @param   pCpu        CPU info struct
    768767 */
    769 HWACCMR0DECL(int) SVMR0RunGuestCode(PVM pVM, CPUMCTX *pCtx, PHWACCM_CPUINFO pCpu)
     768HWACCMR0DECL(int) SVMR0RunGuestCode(PVM pVM, CPUMCTX *pCtx)
    770769{
    771770    int         rc = VINF_SUCCESS;
     
    777776
    778777    STAM_PROFILE_ADV_START(&pVM->hwaccm.s.StatEntry, x);
    779 
    780     AssertReturn(pCpu->fConfigured, VERR_EM_INTERNAL_ERROR);
    781778
    782779    pVMCB = (SVM_VMCB *)pVM->hwaccm.s.svm.pVMCB;
     
    879876     *       (until the actual world switch)
    880877     */
     878    PHWACCM_CPUINFO pCpu = HWACCMR0GetCurrentCpu();
    881879    /* Force a TLB flush for the first world switch if the current cpu differs from the one we ran on last. */
    882880    /* Note that this can happen both for start and resume due to long jumps back to ring 3. */
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.h

    r9421 r10502  
    113113 * @param   pVM         The VM to operate on.
    114114 * @param   pCtx        Guest context
    115  * @param   pCpu        CPU info struct
    116115 */
    117 HWACCMR0DECL(int) SVMR0RunGuestCode(PVM pVM, CPUMCTX *pCtx, PHWACCM_CPUINFO pCpu);
     116HWACCMR0DECL(int) SVMR0RunGuestCode(PVM pVM, CPUMCTX *pCtx);
    118117
    119118
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp

    r10473 r10502  
    10221022 * @param   pVM         The VM to operate on.
    10231023 * @param   pCtx        Guest context
    1024  * @param   pCpu        CPU info struct
    10251024 */
    1026 HWACCMR0DECL(int) VMXR0RunGuestCode(PVM pVM, CPUMCTX *pCtx, PHWACCM_CPUINFO pCpu)
     1025HWACCMR0DECL(int) VMXR0RunGuestCode(PVM pVM, CPUMCTX *pCtx)
    10271026{
    10281027    int         rc = VINF_SUCCESS;
     
    10361035
    10371036    Log2(("\nE"));
    1038 
    1039     AssertReturn(pCpu->fConfigured, VERR_EM_INTERNAL_ERROR);
    10401037
    10411038    STAM_PROFILE_ADV_START(&pVM->hwaccm.s.StatEntry, x);
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.h

    r9535 r10502  
    132132 * @param   pVM         The VM to operate on.
    133133 * @param   pCtx        Guest context
    134  * @param   pCpu        CPU info struct
    135134 */
    136 HWACCMR0DECL(int) VMXR0RunGuestCode(PVM pVM, CPUMCTX *pCtx, PHWACCM_CPUINFO pCpu);
     135HWACCMR0DECL(int) VMXR0RunGuestCode(PVM pVM, CPUMCTX *pCtx);
    137136
    138137
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