]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ebc/Synchronization.c
2 Implementation of synchronization functions on EBC.
4 Copyright (c) 2006, Intel Corporation<BR>
5 All rights reserved. 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.
16 Performs an atomic compare exchange operation on a 32-bit
19 Performs an atomic compare exchange operation on the 32-bit
20 unsigned integer specified by Value. If Value is equal to
21 CompareValue, then Value is set to ExchangeValue and
22 CompareValue is returned. If Value is not equal to
23 CompareValue, then Value is returned. The compare exchange
24 operation must be performed using MP safe mechanisms.
26 @param Value A pointer to the 32-bit value for the
27 compare exchange operation.
28 @param CompareValue 32-bit value used in compare operation.
29 @param ExchangeValue 32-bit value used in exchange operation.
31 @return The original *Value before exchange.
36 InternalSyncCompareExchange32 (
37 IN
volatile UINT32
*Value
,
38 IN UINT32 CompareValue
,
39 IN UINT32 ExchangeValue
42 return *Value
!= CompareValue
? *Value
:
43 ((*Value
= ExchangeValue
), CompareValue
);
47 Performs an atomic compare exchange operation on a 64-bit unsigned integer.
49 Performs an atomic compare exchange operation on the 64-bit unsigned integer specified
50 by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and
51 CompareValue is returned. If Value is not equal to CompareValue, then Value is returned.
52 The compare exchange operation must be performed using MP safe mechanisms.
54 @param Value A pointer to the 64-bit value for the compare exchange
56 @param CompareValue 64-bit value used in compare operation.
57 @param ExchangeValue 64-bit value used in exchange operation.
59 @return The original *Value before exchange.
64 InternalSyncCompareExchange64 (
65 IN
volatile UINT64
*Value
,
66 IN UINT64 CompareValue
,
67 IN UINT64 ExchangeValue
70 return *Value
!= CompareValue
? *Value
:
71 ((*Value
= ExchangeValue
), CompareValue
);
75 Performs an atomic increment of an 32-bit unsigned integer.
77 Performs an atomic increment of the 32-bit unsigned integer specified by
78 Value and returns the incremented value. The increment operation must be
79 performed using MP safe mechanisms. The state of the return value is not
80 guaranteed to be MP safe.
82 @param Value A pointer to the 32-bit value to increment.
84 @return The incremented value.
89 InternalSyncIncrement (
90 IN
volatile UINT32
*Value
97 Performs an atomic decrement of an 32-bit unsigned integer.
99 Performs an atomic decrement of the 32-bit unsigned integer specified by
100 Value and returns the decrement value. The decrement operation must be
101 performed using MP safe mechanisms. The state of the return value is not
102 guaranteed to be MP safe.
104 @param Value A pointer to the 32-bit value to decrement.
106 @return The decrement value.
111 InternalSyncDecrement (
112 IN
volatile UINT32
*Value