VirtualBox

Changeset 93830 in vbox


Ignore:
Timestamp:
Feb 17, 2022 4:56:18 PM (3 years ago)
Author:
vboxsync
Message:

VMM/CPUM: Add some helpers for NEM to activate the hyper or guest debug state respectively without loading the host's DRx registers which doesn't work from ring-3 anyway, bugref:9044

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/cpum.h

    r93518 r93830  
    27262726/** Pointer to CPUMR3DbGetEntryByName. */
    27272727typedef DECLCALLBACKPTR(PCCPUMDBENTRY, PFNCPUMDBGETENTRYBYNAME, (const char *pszName));
     2728
     2729VMMR3_INT_DECL(void)    CPUMR3NemActivateGuestDebugState(PVMCPUCC pVCpu);
     2730VMMR3_INT_DECL(void)    CPUMR3NemActivateHyperDebugState(PVMCPUCC pVCpu);
    27282731/** @} */
    27292732#endif /* IN_RING3 */
  • trunk/src/VBox/VMM/VMMR3/CPUM.cpp

    r93745 r93830  
    44484448}
    44494449
     4450
     4451/**
     4452 * Marks the guest debug state as active.
     4453 *
     4454 * @returns nothing.
     4455 * @param   pVCpu       The cross context virtual CPU structure.
     4456 *
     4457 * @note This is used solely by NEM (hence the name) to set the correct flags here
     4458 *       without loading the host's DRx registers, which is not possible from ring-3 anyway.
     4459 *       The specific NEM backends have to make sure to load the correct values.
     4460 */
     4461VMMR3_INT_DECL(void) CPUMR3NemActivateGuestDebugState(PVMCPUCC pVCpu)
     4462{
     4463    ASMAtomicAndU32(&pVCpu->cpum.s.fUseFlags, ~CPUM_USED_DEBUG_REGS_HYPER);
     4464    ASMAtomicOrU32(&pVCpu->cpum.s.fUseFlags, CPUM_USED_DEBUG_REGS_GUEST);
     4465}
     4466
     4467
     4468/**
     4469 * Marks the hyper debug state as active.
     4470 *
     4471 * @returns nothing.
     4472 * @param   pVCpu       The cross context virtual CPU structure.
     4473 *
     4474 * @note This is used solely by NEM (hence the name) to set the correct flags here
     4475 *       without loading the host's DRx registers, which is not possible from ring-3 anyway.
     4476 *       The specific NEM backends have to make sure to load the correct values.
     4477 */
     4478VMMR3_INT_DECL(void) CPUMR3NemActivateHyperDebugState(PVMCPUCC pVCpu)
     4479{
     4480    /*
     4481     * Make sure the hypervisor values are up to date.
     4482     */
     4483    CPUMRecalcHyperDRx(pVCpu, UINT8_MAX /* no loading, please */);
     4484
     4485    ASMAtomicAndU32(&pVCpu->cpum.s.fUseFlags, ~CPUM_USED_DEBUG_REGS_GUEST);
     4486    ASMAtomicOrU32(&pVCpu->cpum.s.fUseFlags, CPUM_USED_DEBUG_REGS_HYPER);
     4487}
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