]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseSynchronizationLib/Ia32/InterlockedCompareExchange64.c
2 InterlockedCompareExchange64 function
4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
13 Performs an atomic compare exchange operation on a 64-bit unsigned integer.
15 Performs an atomic compare exchange operation on the 64-bit unsigned integer specified
16 by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and
17 CompareValue is returned. If Value is not equal to CompareValue, then Value is returned.
18 The compare exchange operation must be performed using MP safe mechanisms.
20 @param Value A pointer to the 64-bit value for the compare exchange
22 @param CompareValue A 64-bit value used in a compare operation.
23 @param ExchangeValue A 64-bit value used in an exchange operation.
25 @return The original *Value before exchange.
30 InternalSyncCompareExchange64 (
31 IN
volatile UINT64
*Value
,
32 IN UINT64 CompareValue
,
33 IN UINT64 ExchangeValue
38 mov eax
, dword ptr
[CompareValue
+ 0]
39 mov edx
, dword ptr
[CompareValue
+ 4]
40 mov ebx
, dword ptr
[ExchangeValue
+ 0]
41 mov ecx
, dword ptr
[ExchangeValue
+ 4]
42 lock cmpxchg8b qword ptr
[esi
]