VirtualBox

Changeset 14875 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 1, 2008 4:24:22 PM (16 years ago)
Author:
vboxsync
Message:

More switcher updates

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/HWACCM.cpp

    r14851 r14875  
    844844        AssertMsgRCReturn(rc, ("SVMGCVMRun64 -> rc=%Rrc\n", rc), rc);
    845845
    846         rc = PDMR3LdrGetSymbolRC(pVM, NULL,       "HWACCMSetupFPU64",   &pVM->hwaccm.s.pfnSetupFPU64);
     846        rc = PDMR3LdrGetSymbolRC(pVM, NULL,       "HWACCMSetupFPU64",   &pVM->hwaccm.s.pfnSaveGuestFPU64);
    847847        AssertMsgRCReturn(rc, ("HWACCMSetupFPU64 -> rc=%Rrc\n", rc), rc);
    848848       
    849         rc = PDMR3LdrGetSymbolRC(pVM, NULL,       "HWACCMSetupDebug64",   &pVM->hwaccm.s.pfnSetupDebug64);
     849        rc = PDMR3LdrGetSymbolRC(pVM, NULL,       "HWACCMSetupDebug64",   &pVM->hwaccm.s.pfnSaveGuestDebug64);
    850850        AssertMsgRCReturn(rc, ("HWACCMSetupDebug64 -> rc=%Rrc\n", rc), rc);
    851851    }
  • trunk/src/VBox/VMM/HWACCMInternal.h

    r14851 r14875  
    167167
    168168/**
     169 * Switcher function, HC to RC.
     170 *
     171 * @param   pVM         The VM handle.
     172 * @returns Return code indicating the action to take.
     173 */
     174typedef DECLASMTYPE(int) FNHWACCMSWITCHERHC(PVM pVM);
     175/** Pointer to switcher function. */
     176typedef FNHWACCMSWITCHERHC *PFNHWACCMSWITCHERHC;
     177
     178/**
    169179 * HWACCM VM Instance data.
    170180 * Changes to this must checked against the padding of the cfgm union in VM!
     
    202212#if HC_ARCH_BITS == 32
    203213    /** 32 to 64 bits switcher entrypoint. */
    204     RTR0PTR                    pfnHost32ToGuest64R0;
     214    R0PTRTYPE(PFNHWACCMSWITCHERHC) pfnHost32ToGuest64R0;
    205215
    206216    /* AMD-V 64 bits vmrun handler */
     
    211221
    212222    /* RC handler to setup the 64 bits FPU state. */
    213     RTRCPTR                     pfnSetupFPU64;
     223    RTRCPTR                     pfnSaveGuestFPU64;
    214224
    215225    /* RC handler to setup the 64 bits debug state. */
    216     RTRCPTR                     pfnSetupDebug64;
     226    RTRCPTR                     pfnSaveGuestDebug64;
    217227#endif
    218228
     
    442452
    443453        /** Ring 0 handlers for VT-x. */
    444         DECLR0CALLBACKMEMBER(int, pfnVMRun,(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx));
     454        DECLR0CALLBACKMEMBER(int, pfnVMRun,(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu));
    445455
    446456    } svm;
  • trunk/src/VBox/VMM/VMMAll/VMMAll.cpp

    r13974 r14875  
    3232
    3333
    34 #ifndef IN_RING0
    3534/**
    3635 * Gets the bottom of the hypervisor stack - RC Ptr.
     
    4645    return (RTRCPTR)pVM->vmm.s.pbEMTStackBottomRC;
    4746}
    48 #endif /* !IN_RING0 */
    4947
    5048
  • trunk/src/VBox/VMM/VMMR0/CPUMR0.cpp

    r14871 r14875  
    3131#include <VBox/err.h>
    3232#include <VBox/log.h>
     33#include <VBox/hwaccm.h>
    3334#include <iprt/assert.h>
    3435#include <iprt/asm.h>
     
    321322    if (CPUMIsGuestInLongModeEx(pCtx))
    322323    {
    323         HWACCMR0SaveDebugState(pVM, pVCpu, pCtx, fDR6);
     324        HWACCMR0SaveDebugState(pVM, pVCpu, pCtx);
    324325    }
    325326    else
  • trunk/src/VBox/VMM/VMMR0/HWACCMR0.cpp

    r14870 r14875  
    10121012{
    10131013    if (pVM->hwaccm.s.vmx.fSupported)
    1014     {
    1015     }
    1016     else
    1017     {
    1018     }
    1019     return VINF_SUCCESS;
     1014        return VMXR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnSaveGuestFPU64);
     1015
     1016    return SVMR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnSaveGuestFPU64);
    10201017}
    10211018
     
    10271024 * @param   pVCpu       VMCPU handle.
    10281025 * @param   pCtx        CPU context
    1029  * @param   fDR6        Include DR6 or not
    1030  */
    1031 VMMR0DECL(int)   HWACCMR0SaveDebugState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, bool fDR6)
     1026 */
     1027VMMR0DECL(int)   HWACCMR0SaveDebugState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
    10321028{
    10331029    if (pVM->hwaccm.s.vmx.fSupported)
    1034     {
    1035     }
    1036     else
    1037     {
    1038     }
    1039     return VINF_SUCCESS;
    1040 }
     1030        return VMXR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnSaveGuestDebug64);
     1031
     1032    return SVMR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnSaveGuestDebug64);
     1033}
     1034
    10411035#endif /* HC_ARCH_BITS == 32 && defined(VBOX_WITH_64_BITS_GUESTS) */
    10421036
  • trunk/src/VBox/VMM/VMMR0/HWACCMR0A.asm

    r14804 r14875  
    11671167ENDPROC   VMXR0StartVM64
    11681168
    1169 ;DECLASM(int) SVMR0VMRun(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx);
     1169;DECLASM(int) SVMR0VMRun(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu);
    11701170BEGINPROC SVMR0VMRun
    11711171    cmp     byte [NAME(g_fVMXIs64bitHost)], 0
     
    12191219ENDPROC   SVMR0VMRun
    12201220
    1221 ; DECLASM(int) SVMR0VMRun64(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx);
     1221; DECLASM(int) SVMR0VMRun64(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu);
    12221222BEGINPROC SVMR0VMRun64
    12231223    cmp     byte [NAME(g_fVMXIs64bitHost)], 0
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp

    r14862 r14875  
    10401040#endif
    10411041    TMNotifyStartOfExecution(pVM);
    1042     pVCpu->hwaccm.s.svm.pfnVMRun(pVM->hwaccm.s.svm.pVMCBHostPhys, pVCpu->hwaccm.s.svm.pVMCBPhys, pCtx);
     1042    pVCpu->hwaccm.s.svm.pfnVMRun(pVM->hwaccm.s.svm.pVMCBHostPhys, pVCpu->hwaccm.s.svm.pVMCBPhys, pCtx, pVM, pVCpu);
    10431043    TMNotifyEndOfExecution(pVM);
    10441044    STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatInGC, x);
     
    22662266}
    22672267
    2268 #if HC_ARCH_BITS == 32
     2268#if HC_ARCH_BITS == 32 && defined(VBOX_WITH_64_BITS_GUESTS)
    22692269/**
    22702270 * Prepares for and executes VMRUN (64 bits guests from a 32 bits hosts).
     
    22742274 * @param   pVMCBPhys       Physical address of the VMCB.
    22752275 * @param   pCtx            Guest context.
     2276 * @param   pVM             The VM to operate on.
     2277 * @param   pVCpu           The VMCPU to operate on.
    22762278 */
    2277 DECLASM(int) SVMR0VMSwitcherRun64(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx)
     2279DECLASM(int) SVMR0VMSwitcherRun64(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu)
    22782280{
     2281    return SVMR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnVMXGCStartVM64);
     2282}
     2283
     2284/**
     2285 * Executes the specified handler in 64 mode
     2286 *
     2287 * @returns VBox status code.
     2288 * @param   pVM         The VM to operate on.
     2289 * @param   pVCpu       The VMCPU to operate on.
     2290 * @param   pCtx        Guest context
     2291 * @param   pfnHandler  RC handler
     2292 */
     2293VMMR0DECL(int) SVMR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, RTRCPTR pfnHandler)
     2294{
     2295    int             rc;
     2296    RTCCUINTREG     uFlags;
     2297
    22792298    /* @todo This code is not guest SMP safe (hyper context) */
    2280 ////    AssertReturn(pVM->cCPUs == 1, VERR_ACCESS_DENIED);
    2281     return VERR_NOT_IMPLEMENTED;
     2299    AssertReturn(pVM->cCPUs == 1, VERR_ACCESS_DENIED);
     2300
     2301    uFlags = ASMIntDisableFlags();
     2302
     2303    CPUMSetHyperESP(pVM, VMMGetStackRC(pVM));
     2304    CPUMSetHyperEIP(pVM, pfnHandler);
     2305
     2306    /* Call switcher. */
     2307    rc = pVM->hwaccm.s.pfnHost32ToGuest64R0(pVM);
     2308
     2309    ASMSetFlags(uFlags);
     2310    return rc;
    22822311}
    22832312
    2284 #endif /* HC_ARCH_BITS == 32 */
     2313#endif /* HC_ARCH_BITS == 32 && defined(VBOX_WITH_64_BITS_GUESTS) */
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.h

    r14366 r14875  
    138138VMMR0DECL(int) SVMR0LoadGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
    139139
     140#if HC_ARCH_BITS == 32 && defined(VBOX_WITH_64_BITS_GUESTS)
     141
     142/**
     143 * Prepares for and executes VMRUN (64 bits guests from a 32 bits hosts).
     144 *
     145 * @returns VBox status code.
     146 * @param   pVMCBHostPhys   Physical address of host VMCB.
     147 * @param   pVMCBPhys       Physical address of the VMCB.
     148 * @param   pCtx            Guest context.
     149 * @param   pVM             The VM to operate on.
     150 * @param   pVCpu           The VMCPU to operate on. (not used)
     151 */
     152DECLASM(int) SVMR0VMSwitcherRun64(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu);
     153
     154/**
     155 * Executes the specified handler in 64 mode
     156 *
     157 * @returns VBox status code.
     158 * @param   pVM         The VM to operate on.
     159 * @param   pVCpu       The VMCPU to operate on.
     160 * @param   pCtx        Guest context
     161 * @param   pfnHandler  RC handler
     162 */
     163VMMR0DECL(int) SVMR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, RTRCPTR pfnHandler);
     164
     165#endif /* HC_ARCH_BITS == 32 && defined(VBOX_WITH_64_BITS_GUESTS) */
     166
    140167/**
    141168 * Prepares for and executes VMRUN (32 bits guests).
     
    145172 * @param   pVMCBPhys       Physical address of the VMCB.
    146173 * @param   pCtx            Guest context.
     174 * @param   pVM             The VM to operate on. (not used)
     175 * @param   pVCpu           The VMCPU to operate on. (not used)
    147176 */
    148 DECLASM(int) SVMR0VMRun(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx);
     177DECLASM(int) SVMR0VMRun(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu);
     178
    149179
    150180/**
     
    155185 * @param   pVMCBPhys       Physical address of the VMCB.
    156186 * @param   pCtx            Guest context.
     187 * @param   pVM             The VM to operate on. (not used)
     188 * @param   pVCpu           The VMCPU to operate on. (not used)
    157189 */
    158 DECLASM(int) SVMR0VMRun64(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx);
    159 
    160 /**
    161  * Prepares for and executes VMRUN (64 bits guests from a 32 bits hosts).
    162  *
    163  * @returns VBox status code.
    164  * @param   pVMCBHostPhys   Physical address of host VMCB.
    165  * @param   pVMCBPhys       Physical address of the VMCB.
    166  * @param   pCtx            Guest context.
    167  */
    168 DECLASM(int) SVMR0VMSwitcherRun64(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx);
     190DECLASM(int) SVMR0VMRun64(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu);
    169191
    170192/**
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp

    r14859 r14875  
    34173417}
    34183418
    3419 #if HC_ARCH_BITS == 32
     3419#if HC_ARCH_BITS == 32 && defined(VBOX_WITH_64_BITS_GUESTS)
    34203420/**
    34213421 * Prepares for and executes VMLAUNCH (64 bits guest mode)
     
    34293429DECLASM(int) VMXR0SwitcherStartVM64(RTHCUINT fResume, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu)
    34303430{
     3431    return VMXR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnVMXGCStartVM64);
     3432}
     3433
     3434/**
     3435 * Executes the specified handler in 64 mode
     3436 *
     3437 * @returns VBox status code.
     3438 * @param   pVM         The VM to operate on.
     3439 * @param   pVCpu       The VMCPU to operate on.
     3440 * @param   pCtx        Guest context
     3441 * @param   pfnHandler  RC handler
     3442 */
     3443VMMR0DECL(int) VMXR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, RTRCPTR pfnHandler)
     3444{
    34313445    int             rc, rc2;
    34323446    RTCCUINTREG     uFlags;
     
    34473461
    34483462    uFlags = ASMIntDisableFlags();
     3463
     3464    CPUMSetHyperESP(pVM, VMMGetStackRC(pVM));
     3465    CPUMSetHyperEIP(pVM, pfnHandler);
     3466
    34493467    /* Call switcher. */
    3450     rc = VERR_ACCESS_DENIED;
     3468    rc = pVM->hwaccm.s.pfnHost32ToGuest64R0(pVM);
    34513469
    34523470    ASMSetFlags(uFlags);
     
    34683486    return rc;
    34693487}
    3470 #endif
    3471 
    3472 
     3488
     3489#endif /* HC_ARCH_BITS == 32 && defined(VBOX_WITH_64_BITS_GUESTS) */
     3490
     3491
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.h

    r14845 r14875  
    139139VMMR0DECL(int) VMXR0RunGuestCode(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
    140140
     141
     142/**
     143 * Executes the specified handler in 64 mode
     144 *
     145 * @returns VBox status code.
     146 * @param   pVM         The VM to operate on.
     147 * @param   pVCpu       The VMCPU to operate on.
     148 * @param   pCtx        Guest context
     149 * @param   pfnHandler  RC handler
     150 */
     151VMMR0DECL(int) VMXR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, RTRCPTR pfnHandler);
    141152
    142153#define VMX_WRITE_SELREG(REG, reg) \
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