]>
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.
13 Module Name: Synchronization.c
19 InternalSyncCompareExchange32 (
20 IN
volatile UINT32
*Value
,
21 IN UINT32 CompareValue
,
22 IN UINT32 ExchangeValue
25 return *Value
!= CompareValue
? *Value
:
26 ((*Value
= ExchangeValue
), CompareValue
);
30 Performs an atomic compare exchange operation on a 64-bit unsigned integer.
32 Performs an atomic compare exchange operation on the 64-bit unsigned integer specified
33 by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and
34 CompareValue is returned. If Value is not equal to CompareValue, then Value is returned.
35 The compare exchange operation must be performed using MP safe mechanisms.
37 @param Value A pointer to the 64-bit value for the compare exchange
39 @param CompareValue 64-bit value used in compare operation.
40 @param ExchangeValue 64-bit value used in exchange operation.
42 @return The original *Value before exchange.
47 InternalSyncCompareExchange64 (
48 IN
volatile UINT64
*Value
,
49 IN UINT64 CompareValue
,
50 IN UINT64 ExchangeValue
53 return *Value
!= CompareValue
? *Value
:
54 ((*Value
= ExchangeValue
), CompareValue
);
58 Performs an atomic increment of an 32-bit unsigned integer.
60 Performs an atomic increment of the 32-bit unsigned integer specified by
61 Value and returns the incremented value. The increment operation must be
62 performed using MP safe mechanisms. The state of the return value is not
63 guaranteed to be MP safe.
65 @param Value A pointer to the 32-bit value to increment.
67 @return The incremented value.
72 InternalSyncIncrement (
73 IN
volatile UINT32
*Value
80 Performs an atomic decrement of an 32-bit unsigned integer.
82 Performs an atomic decrement of the 32-bit unsigned integer specified by
83 Value and returns the decrement value. The decrement operation must be
84 performed using MP safe mechanisms. The state of the return value is not
85 guaranteed to be MP safe.
87 @param Value A pointer to the 32-bit value to decrement.
89 @return The decrement value.
94 InternalSyncDecrement (
95 IN
volatile UINT32
*Value