]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange32.c
2 InterlockedCompareExchange32 function
4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 Performs an atomic compare exchange operation on a 32-bit unsigned integer.
21 Performs an atomic compare exchange operation on the 32-bit unsigned integer
22 specified by Value. If Value is equal to CompareValue, then Value is set to
23 ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,
24 then Value is returned. The compare exchange operation must be performed using
27 @param Value A pointer to the 32-bit value for the compare exchange
29 @param CompareValue 32-bit value used in compare operation.
30 @param ExchangeValue 32-bit value used in exchange operation.
32 @return The original *Value before exchange.
37 InternalSyncCompareExchange32 (
39 IN UINT32 CompareValue
,
40 IN UINT32 ExchangeValue
46 mov edx
, ExchangeValue
47 lock cmpxchg
[ecx
], edx