]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ipf/Synchronization.c
2 Implementation of synchronization functions on Itanium.
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.
15 #include "BaseLibInternals.h"
18 Performs an atomic increment of an 32-bit unsigned integer.
20 Performs an atomic increment of the 32-bit unsigned integer specified by
21 Value and returns the incremented value. The increment operation must be
22 performed using MP safe mechanisms. The state of the return value is not
23 guaranteed to be MP safe.
25 @param Value A pointer to the 32-bit value to increment.
27 @return The incremented value.
32 InternalSyncIncrement (
33 IN
volatile UINT32
*Value
39 OriginalValue
= *Value
;
40 } while (OriginalValue
!= InternalSyncCompareExchange32 (
45 return OriginalValue
+ 1;
49 Performs an atomic decrement of an 32-bit unsigned integer.
51 Performs an atomic decrement of the 32-bit unsigned integer specified by
52 Value and returns the decrement value. The decrement operation must be
53 performed using MP safe mechanisms. The state of the return value is not
54 guaranteed to be MP safe.
56 @param Value A pointer to the 32-bit value to decrement.
58 @return The decrement value.
63 InternalSyncDecrement (
64 IN
volatile UINT32
*Value
70 OriginalValue
= *Value
;
71 } while (OriginalValue
!= InternalSyncCompareExchange32 (
76 return OriginalValue
- 1;