VirtualBox

Changeset 15141 in vbox


Ignore:
Timestamp:
Dec 9, 2008 9:19:20 AM (16 years ago)
Author:
vboxsync
Message:

Cleaned up

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMGC/HWACCMGCA.asm

    r15046 r15141  
    350350
    351351    ; save host fs, gs, sysenter msr etc
    352     mov     rax, [rbp + 8]                  ; pVMCBHostPhys (64 bits physical address)
     352    mov     rax, [rbp + 8 + 8]              ; pVMCBHostPhys (64 bits physical address)
    353353    push    rax                             ; save for the vmload after vmrun
    354354    vmsave
    355355
    356356    ; setup eax for VMLOAD
    357     mov     rax, [rbp + 8 + RTHCPHYS_CB]    ; pVMCBPhys (64 bits physical address)
     357    mov     rax, [rbp + 8 + 8 + RTHCPHYS_CB]   ; pVMCBPhys (64 bits physical address)
    358358
    359359    ;/* Restore Guest's general purpose registers. */
  • trunk/src/VBox/VMM/VMMR0/HWACCMR0.cpp

    r15134 r15141  
    10761076{
    10771077    if (pVM->hwaccm.s.vmx.fSupported)
    1078         return VMXR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnSaveGuestFPU64);
    1079 
    1080     return SVMR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnSaveGuestFPU64);
     1078        return VMXR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnSaveGuestFPU64, 0, NULL);
     1079
     1080    return SVMR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnSaveGuestFPU64, 0, NULL);
    10811081}
    10821082
     
    10921092{
    10931093    if (pVM->hwaccm.s.vmx.fSupported)
    1094         return VMXR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnSaveGuestDebug64);
    1095 
    1096     return SVMR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnSaveGuestDebug64);
    1097 }
    1098 
    1099 #ifdef DEBUG
     1094        return VMXR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnSaveGuestDebug64, 0, NULL);
     1095
     1096    return SVMR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnSaveGuestDebug64, 0, NULL);
     1097}
     1098
     1099# ifdef DEBUG
    11001100/**
    11011101 * Test the 32->64 bits switcher
     
    11081108    PVMCPU   pVCpu = &pVM->aCpus[0];
    11091109    CPUMCTX *pCtx;
     1110    uint32_t aParam[5] = {0, 1, 2, 3, 4};
    11101111
    11111112    pCtx = CPUMQueryGuestCtxPtrEx(pVM, pVCpu);
    11121113
    11131114    if (pVM->hwaccm.s.vmx.fSupported)
    1114         return VMXR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnTest64);
     1115        return VMXR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnTest64, 5, &aParam[0]);
    11151116
    11161117    return SVMR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnTest64);
    11171118}
    1118 #endif
     1119# endif
    11191120
    11201121#endif /* HC_ARCH_BITS == 32 && defined(VBOX_WITH_64_BITS_GUESTS) */
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp

    r15072 r15141  
    22902290DECLASM(int) SVMR0VMSwitcherRun64(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu)
    22912291{
    2292     int             rc;
    2293     RTCCUINTREG     uFlags;
    2294 
    2295     /* @todo This code is not guest SMP safe (hyper context) */
    2296     AssertReturn(pVM->cCPUs == 1, VERR_ACCESS_DENIED);
    2297 
    2298     uFlags = ASMIntDisableFlags();
    2299 
    2300     CPUMSetHyperESP(pVM, VMMGetStackRC(pVM));
    2301     CPUMPushHyper(pVM, (uint32_t)(pVMCBHostPhys >> 32));    /* Param 2: pVMCBHostPhys - Hi. */
    2302     CPUMPushHyper(pVM, (uint32_t)pVMCBHostPhys);            /* Param 2: pVMCBHostPhys - Lo. */
    2303     CPUMPushHyper(pVM, (uint32_t)(pVMCBPhys >> 32));        /* Param 1: pVMCBPhys - Hi. */
    2304     CPUMPushHyper(pVM, (uint32_t)pVMCBPhys);                /* Param 1: pVMCBPhys - Lo. */
    2305     CPUMSetHyperEIP(pVM, pVM->hwaccm.s.pfnVMXGCStartVM64);
    2306 
    2307     /* Call switcher. */
    2308     rc = pVM->hwaccm.s.pfnHost32ToGuest64R0(pVM);
    2309 
    2310     ASMSetFlags(uFlags);
    2311     return rc;
     2292    uint32_t aParam[4];
     2293    int      rc;
     2294
     2295    aParam[0] = (uint32_t)(pVMCBHostPhys >> 32);            /* Param 1: pVMCBHostPhys - Hi. */
     2296    aParam[1] = (uint32_t)(pVMCBHostPhys);                  /* Param 1: pVMCBHostPhys - Lo. */
     2297    aParam[2] = (uint32_t)(pVMCBPhys >> 32);                /* Param 2: pVMCBPhys - Hi. */
     2298    aParam[3] = (uint32_t)(pVMCBPhys);                      /* Param 2: pVMCBPhys - Lo. */
     2299
     2300    return SVMR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnVMXGCStartVM64, 4, &aParam[0]);
    23122301}
    23132302
     
    23202309 * @param   pCtx        Guest context
    23212310 * @param   pfnHandler  RC handler
     2311 * @param   cbParam     Number of parameters
     2312 * @param   paParam     Array of 32 bits parameters
    23222313 */
    2323 VMMR0DECL(int) SVMR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, RTRCPTR pfnHandler)
     2314VMMR0DECL(int) SVMR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, RTRCPTR pfnHandler, uint32_t cbParam, uint32_t *paParam)
    23242315{
    23252316    int             rc;
     
    23332324    CPUMSetHyperESP(pVM, VMMGetStackRC(pVM));
    23342325    CPUMSetHyperEIP(pVM, pfnHandler);
     2326    for (int i=(int)cbParam-1;i>=0;i++)
     2327        CPUMPushHyper(pVM, paParam[i]);
    23352328
    23362329    /* Call switcher. */
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.h

    r14875 r15141  
    160160 * @param   pCtx        Guest context
    161161 * @param   pfnHandler  RC handler
    162  */
    163 VMMR0DECL(int) SVMR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, RTRCPTR pfnHandler);
     162 * @param   cbParam     Number of parameters
     163 * @param   paParam     Array of 32 bits parameters
     164 */
     165VMMR0DECL(int) SVMR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, RTRCPTR pfnHandler, uint32_t cbParam, uint32_t *paParam);
    164166
    165167#endif /* HC_ARCH_BITS == 32 && defined(VBOX_WITH_64_BITS_GUESTS) */
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp

    r15072 r15141  
    34413441DECLASM(int) VMXR0SwitcherStartVM64(RTHCUINT fResume, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu)
    34423442{
    3443     int             rc, rc2;
    3444     RTCCUINTREG     uFlags;
     3443    uint32_t        aParam[4];
     3444    int             rc;
    34453445    PHWACCM_CPUINFO pCpu;
    34463446    RTHCPHYS        pPageCpuPhys;
    34473447
    3448     /* @todo This code is not guest SMP safe (hyper context) */
    3449     AssertReturn(pVM->cCPUs == 1, VERR_ACCESS_DENIED);
    3450     AssertReturn(pVM->hwaccm.s.pfnHost32ToGuest64R0, VERR_INTERNAL_ERROR);
    3451 
    34523448    pCpu = HWACCMR0GetCurrentCpuEx(pVCpu->idCpu);
    34533449    pPageCpuPhys = RTR0MemObjGetPagePhysAddr(pCpu->pMemObj, 0);
    34543450
    3455     /* Clear VM Control Structure. Marking it inactive, clearing implementation specific data and writing back VMCS data to memory. */
    3456     VMXClearVMCS(pVCpu->hwaccm.s.vmx.pVMCSPhys);
    3457 
    3458     /* Leave VMX Root Mode. */
    3459     VMXDisable();
    3460 
    3461     uFlags = ASMIntDisableFlags();
    3462 
    3463     CPUMSetHyperESP(pVM, VMMGetStackRC(pVM));
    3464     CPUMPushHyper(pVM, (uint32_t)(pVCpu->hwaccm.s.vmx.pVMCSPhys >> 32));    /* Param 2: pVMCBHostPhys - Hi. */
    3465     CPUMPushHyper(pVM, (uint32_t)pVCpu->hwaccm.s.vmx.pVMCSPhys);            /* Param 2: pVMCBHostPhys - Lo. */
    3466     CPUMPushHyper(pVM, (uint32_t)(pPageCpuPhys >> 32));                     /* Param 1: pVMCBPhys - Hi. */
    3467     CPUMPushHyper(pVM, (uint32_t)pPageCpuPhys);                             /* Param 1: pVMCBPhys - Lo. */
    3468     CPUMSetHyperEIP(pVM, pVM->hwaccm.s.pfnVMXGCStartVM64);
    3469 
    3470     /* Call switcher. */
    3471     rc = pVM->hwaccm.s.pfnHost32ToGuest64R0(pVM);
    3472 
    3473     ASMSetFlags(uFlags);
    3474 
    3475     /* Make sure the VMX instructions don't cause #UD faults. */
    3476     ASMSetCR4(ASMGetCR4() | X86_CR4_VMXE);
    3477 
    3478     /* Enter VMX Root Mode */
    3479     rc2 = VMXEnable(pPageCpuPhys);
    3480     if (RT_FAILURE(rc2))
    3481     {
    3482         if (pVM)
    3483             VMXR0CheckError(pVM, pVCpu, rc2);
    3484         ASMSetCR4(ASMGetCR4() & ~X86_CR4_VMXE);
    3485         return VERR_VMX_VMXON_FAILED;
    3486     }
    3487 
    3488     VMXActivateVMCS(pVCpu->hwaccm.s.vmx.pVMCSPhys);
    3489     return rc;
     3451    aParam[0] = (uint32_t)(pPageCpuPhys >> 32));                            /* Param 1: VMXON physical address - Hi. */
     3452    aParam[1] = (uint32_t)(pPageCpuPhys);                                   /* Param 1: VMXON physical address - Lo. */
     3453    aParam[2] = (uint32_t)(pVCpu->hwaccm.s.vmx.pVMCSPhys >> 32);            /* Param 2: VMCS physical address - Hi. */
     3454    aParam[3] = (uint32_t)(pVCpu->hwaccm.s.vmx.pVMCSPhys);                  /* Param 2: VMCS physical address - Lo. */
     3455
     3456    return VMXR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnVMXGCStartVM64, 4, &aParam[0]);
    34903457}
    34913458
     
    34983465 * @param   pCtx        Guest context
    34993466 * @param   pfnHandler  RC handler
     3467 * @param   cbParam     Number of parameters
     3468 * @param   paParam     Array of 32 bits parameters
    35003469 */
    3501 VMMR0DECL(int) VMXR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, RTRCPTR pfnHandler)
     3470VMMR0DECL(int) VMXR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, RTRCPTR pfnHandler, uint32_t cbParam, uint32_t *paParam)
    35023471{
    35033472    int             rc, rc2;
     
    35233492    CPUMSetHyperESP(pVM, VMMGetStackRC(pVM));
    35243493    CPUMSetHyperEIP(pVM, pfnHandler);
     3494    for (int i=(int)cbParam-1;i>=0;i++)
     3495        CPUMPushHyper(pVM, paParam[i]);
    35253496
    35263497    /* Call switcher. */
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.h

    r14997 r15141  
    148148 * @param   pCtx        Guest context
    149149 * @param   pfnHandler  RC handler
    150  */
    151 VMMR0DECL(int) VMXR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, RTRCPTR pfnHandler);
     150 * @param   cbParam     Number of parameters
     151 * @param   paParam     Array of 32 bits parameters
     152 */
     153VMMR0DECL(int) VMXR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, RTRCPTR pfnHandler, uint32_t cbParam, uint32_t *paParam);
    152154
    153155#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