4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** @file
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Provides synchronization functions.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncCopyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncThis program and the accompanying materials
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncare licensed and made available under the terms and conditions of the BSD License
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncwhich accompanies this distribution. The full text of the license may be found at
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsynchttp://opensource.org/licenses/bsd-license.php
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncTHE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncWITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#ifndef __SYNCHRONIZATION_LIB__
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#define __SYNCHRONIZATION_LIB__
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync///
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/// Definitions for SPIN_LOCK
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync///
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsynctypedef volatile UINTN SPIN_LOCK;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Retrieves the architecture-specific spin lock alignment requirements for
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync optimal spin lock performance.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync This function retrieves the spin lock alignment requirements for optimal
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync performance on a given CPU architecture. The spin lock alignment must be a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync power of two and is returned by this function. If there are no alignment
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync requirements, then 1 must be returned. The spin lock synchronization
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync functions must function correctly if the spin lock size and alignment values
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync returned by this function are not used at all. These values are hints to the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync consumers of the spin lock synchronization functions to obtain optimal spin
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync lock performance.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The architecture-specific spin lock alignment.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncUINTN
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncGetSpinLockProperties (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync VOID
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync );
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Initializes a spin lock to the released state and returns the spin lock.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync This function initializes the spin lock specified by SpinLock to the released
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync state, and returns SpinLock. Optimal performance can be achieved by calling
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync GetSpinLockProperties() to determine the size and alignment requirements for
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync SpinLock.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If SpinLock is NULL, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param SpinLock A pointer to the spin lock to initialize to the released
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync state.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return SpinLock in release state.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncSPIN_LOCK *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncInitializeSpinLock (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync OUT SPIN_LOCK *SpinLock
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync );
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Waits until a spin lock can be placed in the acquired state.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync This function checks the state of the spin lock specified by SpinLock. If
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync SpinLock is in the released state, then this function places SpinLock in the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync acquired state and returns SpinLock. Otherwise, this function waits
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync indefinitely for the spin lock to be released, and then places it in the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync acquired state and returns SpinLock. All state transitions of SpinLock must
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync be performed using MP safe mechanisms.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If SpinLock is NULL, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If SpinLock was not initialized with InitializeSpinLock(), then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If PcdSpinLockTimeout is not zero, and SpinLock is can not be acquired in
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync PcdSpinLockTimeout microseconds, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param SpinLock A pointer to the spin lock to place in the acquired state.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return SpinLock acquired lock.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncSPIN_LOCK *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncAcquireSpinLock (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN OUT SPIN_LOCK *SpinLock
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync );
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Attempts to place a spin lock in the acquired state.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync This function checks the state of the spin lock specified by SpinLock. If
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync SpinLock is in the released state, then this function places SpinLock in the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync acquired state and returns TRUE. Otherwise, FALSE is returned. All state
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync transitions of SpinLock must be performed using MP safe mechanisms.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If SpinLock is NULL, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If SpinLock was not initialized with InitializeSpinLock(), then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param SpinLock A pointer to the spin lock to place in the acquired state.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval TRUE SpinLock was placed in the acquired state.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @retval FALSE SpinLock could not be acquired.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncBOOLEAN
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncAcquireSpinLockOrFail (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN OUT SPIN_LOCK *SpinLock
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync );
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Releases a spin lock.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync This function places the spin lock specified by SpinLock in the release state
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync and returns SpinLock.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If SpinLock is NULL, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If SpinLock was not initialized with InitializeSpinLock(), then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param SpinLock A pointer to the spin lock to release.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return SpinLock released lock.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncSPIN_LOCK *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncReleaseSpinLock (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN OUT SPIN_LOCK *SpinLock
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync );
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Performs an atomic increment of a 32-bit unsigned integer.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Performs an atomic increment of the 32-bit unsigned integer specified by
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Value and returns the incremented value. The increment operation must be
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync performed using MP safe mechanisms. The state of the return value is not
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync guaranteed to be MP safe.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If Value is NULL, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Value A pointer to the 32-bit value to increment.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The incremented value.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncUINT32
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncInterlockedIncrement (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINT32 *Value
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync );
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Performs an atomic decrement of a 32-bit unsigned integer.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Performs an atomic decrement of the 32-bit unsigned integer specified by
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Value and returns the decremented value. The decrement operation must be
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync performed using MP safe mechanisms. The state of the return value is not
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync guaranteed to be MP safe.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If Value is NULL, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Value A pointer to the 32-bit value to decrement.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The decremented value.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncUINT32
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncInterlockedDecrement (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINT32 *Value
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync );
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Performs an atomic compare exchange operation on a 32-bit unsigned integer.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Performs an atomic compare exchange operation on the 32-bit unsigned integer
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync specified by Value. If Value is equal to CompareValue, then Value is set to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync then Value is returned. The compare exchange operation must be performed using
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync MP safe mechanisms.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If Value is NULL, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Value A pointer to the 32-bit value for the compare exchange
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync operation.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param CompareValue 32-bit value used in compare operation.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param ExchangeValue 32-bit value used in exchange operation.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The original *Value before exchange.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncUINT32
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncInterlockedCompareExchange32 (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN OUT UINT32 *Value,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINT32 CompareValue,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINT32 ExchangeValue
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync );
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Performs an atomic compare exchange operation on a 64-bit unsigned integer.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Performs an atomic compare exchange operation on the 64-bit unsigned integer specified
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CompareValue is returned. If Value is not equal to CompareValue, then Value is returned.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync The compare exchange operation must be performed using MP safe mechanisms.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If Value is NULL, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Value A pointer to the 64-bit value for the compare exchange
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync operation.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param CompareValue 64-bit value used in compare operation.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param ExchangeValue 64-bit value used in exchange operation.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The original *Value before exchange.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncUINT64
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncInterlockedCompareExchange64 (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN OUT UINT64 *Value,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINT64 CompareValue,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINT64 ExchangeValue
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync );
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Performs an atomic compare exchange operation on a pointer value.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Performs an atomic compare exchange operation on the pointer value specified
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync by Value. If Value is equal to CompareValue, then Value is set to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ExchangeValue and CompareValue is returned. If Value is not equal to
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CompareValue, then Value is returned. The compare exchange operation must be
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync performed using MP safe mechanisms.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If Value is NULL, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Value A pointer to the pointer value for the compare exchange
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync operation.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param CompareValue Pointer value used in compare operation.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param ExchangeValue Pointer value used in exchange operation.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The original *Value before exchange.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncVOID *
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncInterlockedCompareExchangePointer (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN OUT VOID **Value,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN VOID *CompareValue,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN VOID *ExchangeValue
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync );
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#endif
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync