]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.c
cbd4992fce11f97982c7c66a83b8f0a4e8bb656c
2 InterlockedCompareExchange32 function
4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
10 Performs an atomic compare exchange operation on a 32-bit unsigned integer.
12 Performs an atomic compare exchange operation on the 32-bit unsigned integer
13 specified by Value. If Value is equal to CompareValue, then Value is set to
14 ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,
15 then Value is returned. The compare exchange operation must be performed using
18 @param Value A pointer to the 32-bit value for the compare exchange
20 @param CompareValue 32-bit value used in compare operation.
21 @param ExchangeValue 32-bit value used in exchange operation.
23 @return The original *Value before exchange.
28 InternalSyncCompareExchange32 (
29 IN
volatile UINT32
*Value
,
30 IN UINT32 CompareValue
,
31 IN UINT32 ExchangeValue
37 mov edx
, ExchangeValue
38 lock cmpxchg
[ecx
], edx