]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseSynchronizationLib/Ebc/Synchronization.c
2 Implementation of synchronization functions on EBC.
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
10 Performs an atomic compare exchange operation on a 16-bit
13 Performs an atomic compare exchange operation on the 16-bit
14 unsigned integer specified by Value. If Value is equal to
15 CompareValue, then Value is set to ExchangeValue and
16 CompareValue is returned. If Value is not equal to
17 CompareValue, then Value is returned. The compare exchange
18 operation must be performed using MP safe mechanisms.
20 @param Value A pointer to the 16-bit value for the
21 compare exchange operation.
22 @param CompareValue 16-bit value used in compare operation.
23 @param ExchangeValue 16-bit value used in exchange operation.
25 @return The original *Value before exchange.
30 InternalSyncCompareExchange16 (
31 IN
volatile UINT16
*Value
,
32 IN UINT16 CompareValue
,
33 IN UINT16 ExchangeValue
36 return *Value
!= CompareValue
? *Value
:
37 ((*Value
= ExchangeValue
), CompareValue
);
41 Performs an atomic compare exchange operation on a 32-bit
44 Performs an atomic compare exchange operation on the 32-bit
45 unsigned integer specified by Value. If Value is equal to
46 CompareValue, then Value is set to ExchangeValue and
47 CompareValue is returned. If Value is not equal to
48 CompareValue, then Value is returned. The compare exchange
49 operation must be performed using MP safe mechanisms.
51 @param Value A pointer to the 32-bit value for the
52 compare exchange operation.
53 @param CompareValue 32-bit value used in compare operation.
54 @param ExchangeValue 32-bit value used in exchange operation.
56 @return The original *Value before exchange.
61 InternalSyncCompareExchange32 (
62 IN
volatile UINT32
*Value
,
63 IN UINT32 CompareValue
,
64 IN UINT32 ExchangeValue
67 return *Value
!= CompareValue
? *Value
:
68 ((*Value
= ExchangeValue
), CompareValue
);
72 Performs an atomic compare exchange operation on a 64-bit unsigned integer.
74 Performs an atomic compare exchange operation on the 64-bit unsigned integer specified
75 by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and
76 CompareValue is returned. If Value is not equal to CompareValue, then Value is returned.
77 The compare exchange operation must be performed using MP safe mechanisms.
79 @param Value A pointer to the 64-bit value for the compare exchange
81 @param CompareValue 64-bit value used in compare operation.
82 @param ExchangeValue 64-bit value used in exchange operation.
84 @return The original *Value before exchange.
89 InternalSyncCompareExchange64 (
90 IN
volatile UINT64
*Value
,
91 IN UINT64 CompareValue
,
92 IN UINT64 ExchangeValue
95 return *Value
!= CompareValue
? *Value
:
96 ((*Value
= ExchangeValue
), CompareValue
);
100 Performs an atomic increment of an 32-bit unsigned integer.
102 Performs an atomic increment of the 32-bit unsigned integer specified by
103 Value and returns the incremented value. The increment operation must be
104 performed using MP safe mechanisms. The state of the return value is not
105 guaranteed to be MP safe.
107 @param Value A pointer to the 32-bit value to increment.
109 @return The incremented value.
114 InternalSyncIncrement (
115 IN
volatile UINT32
*Value
122 Performs an atomic decrement of an 32-bit unsigned integer.
124 Performs an atomic decrement of the 32-bit unsigned integer specified by
125 Value and returns the decrement value. The decrement operation must be
126 performed using MP safe mechanisms. The state of the return value is not
127 guaranteed to be MP safe.
129 @param Value A pointer to the 32-bit value to decrement.
131 @return The decrement value.
136 InternalSyncDecrement (
137 IN
volatile UINT32
*Value