VirtualBox

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


Ignore:
Timestamp:
May 23, 2014 7:45:35 AM (11 years ago)
Author:
vboxsync
Message:

VMM/GIM: Hyper-V provider, work-in-progress.

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

Legend:

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

    r51333 r51367  
    8181VMM_INT_DECL(int) GIMReadMsr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
    8282{
     83    Assert(pVCpu);
    8384    PVM pVM = pVCpu->CTX_SUFF(pVM);
    8485    Assert(GIMIsEnabled(pVM));
     
    109110VMM_INT_DECL(int) GIMWriteMsr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
    110111{
     112    Assert(pVCpu);
    111113    PVM pVM = pVCpu->CTX_SUFF(pVM);
    112114    Assert(GIMIsEnabled(pVM));
  • trunk/src/VBox/VMM/VMMAll/GIMAllHv.cpp

    r51333 r51367  
    2323#include "GIMHvInternal.h"
    2424
    25 #include <iprt/err.h>
     25#include <VBox/err.h>
     26#include <VBox/vmm/tm.h>
     27#include <VBox/vmm/vm.h>
    2628
    2729DECLEXPORT(int) GIMHvHypercall(PVMCPU pVCpu, PCPUMCTX pCtx)
     
    3335DECLEXPORT(int) GIMHvReadMsr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
    3436{
    35     return VINF_SUCCESS;
     37    NOREF(pRange);
     38    switch (idMsr)
     39    {
     40        case MSR_GIM_HV_TIME_REF_COUNT:
     41        {
     42            /* Hyper-V reports the time in 100ns units. */
     43            uint64_t u64Tsc      = TMCpuTickGet(pVCpu);
     44            uint64_t u64TscHz    = TMCpuTicksPerSecond(pVCpu->CTX_SUFF(pVM));
     45            uint64_t u64Tsc100Ns = u64TscHz / UINT64_C(10000000); /* 100 ns */
     46            *puValue = (u64Tsc / u64Tsc100Ns);
     47            return VINF_SUCCESS;
     48        }
     49
     50        case MSR_GIM_HV_VP_INDEX:
     51            *puValue = pVCpu->idCpu;
     52            return VINF_SUCCESS;
     53
     54        default:
     55            break;
     56    }
     57
     58    LogRel(("GIMHvReadMsr: Unknown/invalid RdMsr %#RX32 -> #GP(0)\n", idMsr));
     59    return VERR_CPUM_RAISE_GP_0;
    3660}
    3761
     
    3963DECLEXPORT(int) GIMHvWriteMsr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
    4064{
    41     return VINF_SUCCESS;
     65    LogRel(("GIMHvWriteMsr: Unknown/invalid WrMsr %#RX32 -> #GP(0)\n", idMsr));
     66    return VERR_CPUM_RAISE_GP_0;
    4267}
    4368
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