VirtualBox

Changeset 72541 in vbox for trunk/src/VBox/VMM/VMMR0


Ignore:
Timestamp:
Jun 13, 2018 12:14:00 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
123031
Message:

NEM/win: Added TSC offset to the complaint list. Some exploration of registers and partition properties. bugref:9044.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/NEMR0Native-win.cpp

    r72522 r72541  
    333333                          VERR_NEM_INIT_FAILED);
    334334
    335 
    336335    return rc;
    337336}
     
    22852284}
    22862285
     2286
    22872287VMMR0_INT_DECL(VBOXSTRICTRC) NEMR0RunGuestCode(PGVM pGVM, VMCPUID idCpu)
    22882288{
     
    23692369}
    23702370
     2371
     2372#if 1 && defined(DEBUG_bird)
     2373/**
     2374 * Debug only interface for poking around and exploring Hyper-V stuff.
     2375 *
     2376 * @param   pGVM        The ring-0 VM handle.
     2377 * @param   pVM         The cross context VM handle.
     2378 * @param   idCpu       The calling EMT.
     2379 * @param   u64Arg      What to query.  0 == registers.
     2380 */
     2381VMMR0_INT_DECL(int) NEMR0DoExperiment(PGVM pGVM, PVM pVM, VMCPUID idCpu, uint64_t u64Arg)
     2382{
     2383    /*
     2384     * Resolve CPU structures.
     2385     */
     2386    int rc = GVMMR0ValidateGVMandVMandEMT(pGVM, pVM, idCpu);
     2387    if (RT_SUCCESS(rc))
     2388    {
     2389        PGVMCPU pGVCpu = &pGVM->aCpus[idCpu];
     2390        PVMCPU  pVCpu  = &pVM->aCpus[idCpu];
     2391        if (u64Arg == 0)
     2392        {
     2393            /*
     2394             * Query register.
     2395             */
     2396            HV_INPUT_GET_VP_REGISTERS *pInput = (HV_INPUT_GET_VP_REGISTERS *)pGVCpu->nem.s.HypercallData.pbPage;
     2397            AssertPtrReturn(pInput, VERR_INTERNAL_ERROR_3);
     2398
     2399            size_t const cbInput = RT_ALIGN_Z(RT_OFFSETOF(HV_INPUT_GET_VP_REGISTERS, Names[1]), 32);
     2400            HV_REGISTER_VALUE *paValues = (HV_REGISTER_VALUE *)((uint8_t *)pInput + cbInput);
     2401            RT_BZERO(paValues, sizeof(paValues[0]) * 1);
     2402
     2403            pInput->PartitionId = pGVM->nem.s.idHvPartition;
     2404            pInput->VpIndex     = pGVCpu->idCpu;
     2405            pInput->fFlags      = 0;
     2406            pInput->Names[0]    = (HV_REGISTER_NAME)pVCpu->nem.s.Hypercall.Experiment.uItem;
     2407
     2408            uint64_t uResult = g_pfnHvlInvokeHypercall(HV_MAKE_CALL_INFO(HvCallGetVpRegisters, 1),
     2409                                                       pGVCpu->nem.s.HypercallData.HCPhysPage,
     2410                                                       pGVCpu->nem.s.HypercallData.HCPhysPage + cbInput);
     2411            pVCpu->nem.s.Hypercall.Experiment.fSuccess = uResult == HV_MAKE_CALL_REP_RET(1);
     2412            pVCpu->nem.s.Hypercall.Experiment.uStatus  = uResult;
     2413            pVCpu->nem.s.Hypercall.Experiment.uLoValue = paValues[0].Reg128.Low64;
     2414            pVCpu->nem.s.Hypercall.Experiment.uHiValue = paValues[0].Reg128.High64;
     2415            rc = VINF_SUCCESS;
     2416        }
     2417        else if (u64Arg == 1)
     2418        {
     2419            /*
     2420             * Query partition property.
     2421             */
     2422            HV_INPUT_GET_PARTITION_PROPERTY *pInput = (HV_INPUT_GET_PARTITION_PROPERTY *)pGVCpu->nem.s.HypercallData.pbPage;
     2423            AssertPtrReturn(pInput, VERR_INTERNAL_ERROR_3);
     2424
     2425            size_t const cbInput = RT_ALIGN_Z(sizeof(*pInput), 32);
     2426            HV_OUTPUT_GET_PARTITION_PROPERTY *pOutput = (HV_OUTPUT_GET_PARTITION_PROPERTY *)((uint8_t *)pInput + cbInput);
     2427            pOutput->PropertyValue = 0;
     2428
     2429            pInput->PartitionId  = pGVM->nem.s.idHvPartition;
     2430            pInput->PropertyCode = (HV_PARTITION_PROPERTY_CODE)pVCpu->nem.s.Hypercall.Experiment.uItem;
     2431            pInput->uPadding     = 0;
     2432
     2433            uint64_t uResult = g_pfnHvlInvokeHypercall(HvCallGetPartitionProperty,
     2434                                                       pGVCpu->nem.s.HypercallData.HCPhysPage,
     2435                                                       pGVCpu->nem.s.HypercallData.HCPhysPage + cbInput);
     2436            pVCpu->nem.s.Hypercall.Experiment.fSuccess = uResult == HV_STATUS_SUCCESS;
     2437            pVCpu->nem.s.Hypercall.Experiment.uStatus  = uResult;
     2438            pVCpu->nem.s.Hypercall.Experiment.uLoValue = pOutput->PropertyValue;
     2439            pVCpu->nem.s.Hypercall.Experiment.uHiValue = 0;
     2440            rc = VINF_SUCCESS;
     2441        }
     2442        else
     2443            rc = VERR_INVALID_FUNCTION;
     2444    }
     2445    return rc;
     2446}
     2447#endif /* DEBUG_bird */
     2448
  • trunk/src/VBox/VMM/VMMR0/VMMR0.cpp

    r72522 r72541  
    20762076            VMM_CHECK_SMAP_CHECK2(pVM, RT_NOTHING);
    20772077            break;
     2078
     2079#   if 1 && defined(DEBUG_bird)
     2080        case VMMR0_DO_NEM_EXPERIMENT:
     2081            if (pReqHdr)
     2082                return VERR_INVALID_PARAMETER;
     2083            rc = NEMR0DoExperiment(pGVM, pVM, idCpu, u64Arg);
     2084            VMM_CHECK_SMAP_CHECK2(pVM, RT_NOTHING);
     2085            break;
     2086#   endif
    20782087# endif
    20792088#endif
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette