VirtualBox

Changeset 50009 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Dec 27, 2013 2:44:05 PM (11 years ago)
Author:
vboxsync
Message:

VMMRZCallRing3Disable,VMMRZCallRing3Enable: Made them preemption aware. ASSUMING that this only applies to ring-0 as we're normally running with interrupts disabled in raw-mode.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMRZ/VMMRZ.cpp

    r48473 r50009  
    2626
    2727#include <iprt/assert.h>
     28#include <iprt/asm-amd64-x86.h>
    2829#include <iprt/string.h>
    2930
     
    128129{
    129130    VMCPU_ASSERT_EMT(pVCpu);
     131#if defined(LOG_ENABLED) && defined(IN_RING0)
     132    RTCCUINTREG fFlags = ASMIntDisableFlags(); /* preemption consistency. */
     133#endif
     134
    130135    Assert(pVCpu->vmm.s.cCallRing3Disabled < 16);
    131     if (++pVCpu->vmm.s.cCallRing3Disabled == 1)
     136    if (ASMAtomicIncU32(&pVCpu->vmm.s.cCallRing3Disabled) == 1) /** @todo replace with unordered variant (ASMAtomicUoIncU32). */
    132137    {
    133138        /** @todo it might make more sense to just disable logging here, then we
     
    142147#endif
    143148    }
     149
     150#if defined(LOG_ENABLED) && defined(IN_RING0)
     151    ASMSetFlags(fFlags);
     152#endif
    144153}
    145154
     
    154163{
    155164    VMCPU_ASSERT_EMT(pVCpu);
     165#if defined(LOG_ENABLED) && defined(IN_RING0)
     166    RTCCUINTREG fFlags = ASMIntDisableFlags(); /* preemption consistency. */
     167#endif
     168
    156169    Assert(pVCpu->vmm.s.cCallRing3Disabled > 0);
    157     if (--pVCpu->vmm.s.cCallRing3Disabled == 0)
     170    if (ASMAtomicDecU32(&pVCpu->vmm.s.cCallRing3Disabled) == 0) /** @todo replace with unordered variant (ASMAtomicUoDecU32). */
    158171    {
    159172#ifdef IN_RC
     
    166179#endif
    167180    }
     181
     182#if defined(LOG_ENABLED) && defined(IN_RING0)
     183    ASMSetFlags(fFlags);
     184#endif
    168185}
    169186
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