]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/XenBusDxe/InterlockedCompareExchange16.h
OvmfPkg/XenBusDxe: Add InterlockedCompareExchange16.
[mirror_edk2.git] / OvmfPkg / XenBusDxe / InterlockedCompareExchange16.h
1 /**
2 Assembly implementation of InterlockedCompareExchange16.
3
4 Look at the documentation of InterlockedCompareExchange16.
5 **/
6 UINT16
7 EFIAPI
8 InternalSyncCompareExchange16 (
9 IN volatile UINT16 *Value,
10 IN UINT16 CompareValue,
11 IN UINT16 ExchangeValue
12 );
13
14 /**
15 Performs an atomic compare exchange operation on a 16-bit unsigned integer.
16
17 Performs an atomic compare exchange operation on the 16-bit unsigned integer
18 specified by Value. If Value is equal to CompareValue, then Value is set to
19 ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,
20 then Value is returned. The compare exchange operation must be performed using
21 MP safe mechanisms.
22
23 If Value is NULL, then ASSERT().
24
25 @param Value A pointer to the 16-bit value for the compare exchange
26 operation.
27 @param CompareValue 16-bit value used in compare operation.
28 @param ExchangeValue 16-bit value used in exchange operation.
29
30 @return The original *Value before exchange.
31 **/
32 UINT16
33 EFIAPI
34 InterlockedCompareExchange16 (
35 IN OUT UINT16 *Value,
36 IN UINT16 CompareValue,
37 IN UINT16 ExchangeValue
38 );