VirtualBox

Changeset 45510 in vbox for trunk


Ignore:
Timestamp:
Apr 12, 2013 9:40:29 AM (12 years ago)
Author:
vboxsync
Message:

VMMR0/HMVMXR0: type fixes.

File:
1 edited

Legend:

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

    r45503 r45510  
    210210static int                hmR0VmxInitVmcsReadCache(PVM pVM, PVMCPU pVCpu);
    211211#endif
    212 #if 0
    213 DECLINLINE(int)           hmR0VmxHandleExit(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient, unsigned rcReason);
     212#if 1
     213DECLINLINE(int)           hmR0VmxHandleExit(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient, uint32_t rcReason);
    214214#endif
    215215
     
    934934 *
    935935 * @param   pVCpu       Pointer to the VMCPU.
    936  * @param   ulMSR       The MSR value.
     936 * @param   uMSR        The MSR value.
    937937 * @param   enmRead     Whether reading this MSR causes a VM-exit.
    938938 * @param   enmWrite    Whether writing this MSR causes a VM-exit.
    939939 */
    940 static void hmR0VmxSetMsrPermission(PVMCPU pVCpu, unsigned ulMsr, VMXMSREXITREAD enmRead, VMXMSREXITWRITE enmWrite)
    941 {
    942     unsigned ulBit;
     940static void hmR0VmxSetMsrPermission(PVMCPU pVCpu, uint32_t uMsr, VMXMSREXITREAD enmRead, VMXMSREXITWRITE enmWrite)
     941{
     942    int32_t iBit;
    943943    uint8_t *pbMsrBitmap = (uint8_t *)pVCpu->hm.s.vmx.pvMsrBitmap;
    944944
     
    950950     * 0xc00 - 0xfff - High MSR write bits
    951951     */
    952     if (ulMsr <= 0x00001FFF)
     952    if (uMsr <= 0x00001FFF)
    953953    {
    954954        /* Pentium-compatible MSRs */
    955         ulBit = ulMsr;
    956     }
    957     else if (   ulMsr >= 0xC0000000
    958              && ulMsr <= 0xC0001FFF)
     955        iBit = uMsr;
     956    }
     957    else if (   uMsr >= 0xC0000000
     958             && uMsr <= 0xC0001FFF)
    959959    {
    960960        /* AMD Sixth Generation x86 Processor MSRs */
    961         ulBit = (ulMsr - 0xC0000000);
     961        iBit = (uMsr - 0xC0000000);
    962962        pbMsrBitmap += 0x400;
    963963    }
    964964    else
    965965    {
    966         AssertMsgFailed(("Invalid MSR %lx\n", ulMsr));
     966        AssertMsgFailed(("hmR0VmxSetMsrPermission: Invalid MSR %#RX32\n", uMsr));
    967967        return;
    968968    }
    969969
    970     Assert(ulBit <= 0x1fff);
     970    Assert(iBit <= 0x1fff);
    971971    if (enmRead == VMXMSREXIT_INTERCEPT_READ)
    972         ASMBitSet(pbMsrBitmap, ulBit);
     972        ASMBitSet(pbMsrBitmap, iBit);
    973973    else
    974         ASMBitClear(pbMsrBitmap, ulBit);
     974        ASMBitClear(pbMsrBitmap, iBit);
    975975
    976976    if (enmWrite == VMXMSREXIT_INTERCEPT_WRITE)
    977         ASMBitSet(pbMsrBitmap + 0x800, ulBit);
     977        ASMBitSet(pbMsrBitmap + 0x800, iBit);
    978978    else
    979         ASMBitClear(pbMsrBitmap + 0x800, ulBit);
     979        ASMBitClear(pbMsrBitmap + 0x800, iBit);
    980980}
    981981
     
    22092209
    22102210    PVMXMSR  pHostMsr           = (PVMXMSR)pVCpu->hm.s.vmx.pvHostMsr;
    2211     unsigned idxHostMsr         = 0;
     2211    uint32_t cHostMsrs          = 0;
    22122212    uint32_t u32HostExtFeatures = pVM->hm.s.cpuid.u32AMDFeatureEDX;
    22132213
     
    22252225#endif
    22262226            pHostMsr->u64Value = ASMRdMsr(MSR_K6_EFER);
    2227         pHostMsr++; idxHostMsr++;
     2227        pHostMsr++; cHostMsrs++;
    22282228    }
    22292229
     
    22342234        pHostMsr->u32Reserved  = 0;
    22352235        pHostMsr->u64Value     = ASMRdMsr(MSR_K6_STAR);              /* legacy syscall eip, cs & ss */
    2236         pHostMsr++; idxHostMsr++;
     2236        pHostMsr++; cHostMsrs++;
    22372237        pHostMsr->u32IndexMSR  = MSR_K8_LSTAR;
    22382238        pHostMsr->u32Reserved  = 0;
    22392239        pHostMsr->u64Value     = ASMRdMsr(MSR_K8_LSTAR);             /* 64 bits mode syscall rip */
    2240         pHostMsr++; idxHostMsr++;
     2240        pHostMsr++; cHostMsrs++;
    22412241        pHostMsr->u32IndexMSR  = MSR_K8_SF_MASK;
    22422242        pHostMsr->u32Reserved  = 0;
    22432243        pHostMsr->u64Value     = ASMRdMsr(MSR_K8_SF_MASK);           /* syscall flag mask */
    2244         pHostMsr++; idxHostMsr++;
     2244        pHostMsr++; cHostMsrs++;
    22452245        /* The KERNEL_GS_BASE MSR doesn't work reliably with auto load/store. See @bugref{6208}  */
    22462246#if 0
     
    22482248        pMsr->u32Reserved = 0;
    22492249        pMsr->u64Value    = ASMRdMsr(MSR_K8_KERNEL_GS_BASE);         /* swapgs exchange value */
    2250         pHostMsr++; idxHostMsr++;
     2250        pHostMsr++; cHostMsrs++;
    22512251#endif
    22522252    }
     
    22542254
    22552255    /* Shouldn't ever happen but there -is- a number. We're well within the recommended 512. */
    2256     if (RT_UNLIKELY(idxHostMsr > MSR_IA32_VMX_MISC_MAX_MSR(pVM->hm.s.vmx.msr.vmx_misc)))
    2257     {
    2258         LogRel(("idxHostMsr=%u Cpu=%u\n", idxHostMsr, (unsigned)MSR_IA32_VMX_MISC_MAX_MSR(pVM->hm.s.vmx.msr.vmx_misc)));
     2256    if (RT_UNLIKELY(cHostMsrs > MSR_IA32_VMX_MISC_MAX_MSR(pVM->hm.s.vmx.msr.vmx_misc)))
     2257    {
     2258        LogRel(("cHostMsrs=%u Cpu=%u\n", cHostMsrs, (unsigned)MSR_IA32_VMX_MISC_MAX_MSR(pVM->hm.s.vmx.msr.vmx_misc)));
    22592259        return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO;
    22602260    }
    22612261
    2262     int rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_EXIT_MSR_LOAD_COUNT, idxHostMsr);
     2262    int rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_EXIT_MSR_LOAD_COUNT, cHostMsrs);
    22632263
    22642264    /*
     
    35643564    {
    35653565        PVMXMSR  pGuestMsr  = (PVMXMSR)pVCpu->hm.s.vmx.pvGuestMsr;
    3566         unsigned cGuestMsrs = 0;
     3566        uint32_t cGuestMsrs = 0;
    35673567
    35683568        /* See Intel spec. 4.1.4 "Enumeration of Paging Features by CPUID". */
     
    44424442
    44434443    /* Make sure there are no duplicates. */
    4444     for (unsigned i = 0; i < pCache->Write.cValidEntries; i++)
     4444    for (uint32_t i = 0; i < pCache->Write.cValidEntries; i++)
    44454445    {
    44464446        if (pCache->Write.aField[i] == idxField)
     
    51025102        return VINF_SUCCESS;
    51035103
    5104     for (unsigned i = 0; i < pVCpu->hm.s.vmx.cGuestMsrs; i++)
     5104    for (uint32_t i = 0; i < pVCpu->hm.s.vmx.cGuestMsrs; i++)
    51055105    {
    51065106        PVMXMSR pMsr = (PVMXMSR)pVCpu->hm.s.vmx.pvGuestMsr;
     
    66626662    VmxTransient.fUpdateTscOffsettingAndPreemptTimer = true;
    66636663    int          rc     = VERR_INTERNAL_ERROR_5;
    6664     unsigned     cLoops = 0;
     6664    uint32_t     cLoops = 0;
    66656665
    66666666    for (;; cLoops++)
     
    67256725
    67266726#if 1
    6727 DECLINLINE(int) hmR0VmxHandleExit(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient, unsigned rcReason)
     6727DECLINLINE(int) hmR0VmxHandleExit(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient, uint32_t rcReason)
    67286728{
    67296729    int rc;
     
    78917891                for (unsigned i = 0; i < 4; i++)
    78927892                {
    7893                     unsigned uBPLen = s_aIOSize[X86_DR7_GET_LEN(pMixedCtx->dr[7], i)];
     7893                    uint32_t uBPLen = s_aIOSize[X86_DR7_GET_LEN(pMixedCtx->dr[7], i)];
    78947894                    if (   (   uIOPort >= pMixedCtx->dr[i]
    78957895                            && uIOPort < pMixedCtx->dr[i] + uBPLen)
     
    80368036
    80378037    /* See Intel spec. 27-6 "Exit Qualifications for APIC-access VM-exits from Linear Accesses & Guest-Phyiscal Addresses" */
    8038     unsigned uAccessType = VMX_EXIT_QUALIFICATION_APIC_ACCESS_TYPE(pVmxTransient->uExitQualification);
     8038    uint32_t uAccessType = VMX_EXIT_QUALIFICATION_APIC_ACCESS_TYPE(pVmxTransient->uExitQualification);
    80398039    switch (uAccessType)
    80408040    {
     
    84678467
    84688468    PDISCPUSTATE pDis = &pVCpu->hm.s.DisState;
    8469     unsigned int cbOp = 0;
     8469    uint32_t cbOp    = 0;
    84708470    PVM pVM           = pVCpu->CTX_SUFF(pVM);
    84718471    rc = EMInterpretDisasCurrent(pVM, pVCpu, pDis, &cbOp);
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