VirtualBox

Changeset 13013 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Oct 6, 2008 2:48:49 PM (16 years ago)
Author:
vboxsync
Message:

infrastructure work for X2APIC support

Location:
trunk/src/VBox/VMM/VMMAll
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/EMAll.cpp

    r12989 r13013  
    3434#include "EMInternal.h"
    3535#include <VBox/vm.h>
     36#include <VBox/vmm.h>
    3637#include <VBox/hwaccm.h>
    3738#include <VBox/tm.h>
     
    25762577#endif
    25772578    default:
    2578         /* We should actually trigger a #GP here, but don't as that might cause more trouble. */
    2579         val = 0;
    2580         break;
     2579        /* In X2APIC specification this range is reserved for APIC control. */
     2580        if ((pRegFrame->ecx >= MSR_IA32_APIC_START) && (pRegFrame->ecx < MSR_IA32_APIC_END))
     2581        {
     2582            rc = PDMApicRDMSR(pVM, VMMGetCpuId(pVM), pRegFrame->ecx, &val);
     2583        }
     2584        else
     2585        {
     2586            /* We should actually trigger a #GP here, but don't as that might cause more trouble. */
     2587            val = 0;
     2588            break;
     2589        }
    25812590    }
    25822591    Log(("EMInterpretRdmsr %s (%x) -> val=%VX64\n", emMSRtoString(pRegFrame->ecx), pRegFrame->ecx, val));
    2583     pRegFrame->eax = (uint32_t) val;
    2584     pRegFrame->edx = (uint32_t) (val >> 32ULL);
    2585     return VINF_SUCCESS;
     2592    if (rc == VINF_SUCCESS)
     2593    {
     2594        pRegFrame->eax = (uint32_t) val;
     2595        pRegFrame->edx = (uint32_t) (val >> 32ULL);
     2596    }
     2597    return rc;
    25862598}
    25872599
     
    27142726
    27152727    default:
     2728        /* In X2APIC specification this range is reserved for APIC control. */
     2729        if ((pRegFrame->ecx >=  MSR_IA32_APIC_START) && (pRegFrame->ecx <  MSR_IA32_APIC_END))
     2730        {
     2731            return PDMApicWRMSR(pVM, VMMGetCpuId(pVM), pRegFrame->ecx, val);
     2732        }
    27162733        /* We should actually trigger a #GP here, but don't as that might cause more trouble. */
    27172734        break;
  • trunk/src/VBox/VMM/VMMAll/PDMAll.cpp

    r12989 r13013  
    253253}
    254254
     255/**
     256 * WRMSR in APIC range.
     257 *
     258 * @returns VBox status code.
     259 * @param   pVM             VM handle.
     260 * @param   iCpu            Target CPU.
     261 * @param   u32Reg          MSR to write.
     262 * @param   u64Value        Value to write.
     263 */
     264VMMDECL(int) PDMApicWRMSR(PVM pVM, VMCPUID iCpu, uint32_t u32Reg, uint64_t u64Value)
     265{
     266    if (pVM->pdm.s.Apic.CTX_SUFF(pDevIns))
     267    {
     268        Assert(pVM->pdm.s.Apic.CTX_SUFF(pfnWRMSR));
     269        pdmLock(pVM);
     270        pVM->pdm.s.Apic.CTX_SUFF(pfnWRMSR)(pVM->pdm.s.Apic.CTX_SUFF(pDevIns), iCpu, u32Reg, u64Value);
     271        pdmUnlock(pVM);
     272        return VINF_SUCCESS;
     273    }
     274    return VERR_PDM_NO_APIC_INSTANCE;
     275}
     276
     277/**
     278 * RDMSR in APIC range.
     279 *
     280 * @returns VBox status code.
     281 * @param   pVM             VM handle.
     282 * @param   iCpu            Target CPU.
     283 * @param   u32Reg          MSR to read.
     284 * @param   pu64Value       Value read.
     285 */
     286VMMDECL(int) PDMApicRDMSR(PVM pVM, VMCPUID iCpu, uint32_t u32Reg, uint64_t *pu64Value)
     287{
     288    if (pVM->pdm.s.Apic.CTX_SUFF(pDevIns))
     289    {
     290        Assert(pVM->pdm.s.Apic.CTX_SUFF(pfnRDMSR));
     291        pdmLock(pVM);
     292        pVM->pdm.s.Apic.CTX_SUFF(pfnRDMSR)(pVM->pdm.s.Apic.CTX_SUFF(pDevIns), iCpu, u32Reg, pu64Value);
     293        pdmUnlock(pVM);
     294        return VINF_SUCCESS;
     295    }
     296    return VERR_PDM_NO_APIC_INSTANCE;
     297}
     298
    255299
    256300/**
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