]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ipf/Synchronization.c
Changed SwitchStack() to _SwitchStack()
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ipf / Synchronization.c
1 /** @file
2 Implementation of synchronization functions on Itanium.
3
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
9
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.
12
13 Module Name: Synchronization.c
14
15 **/
16
17 UINT32
18 EFIAPI
19 InternalSyncCompareExchange32 (
20 IN volatile UINT32 *Value,
21 IN UINT32 CompareValue,
22 IN UINT32 ExchangeValue
23 );
24
25 UINT32
26 EFIAPI
27 InternalSyncIncrement (
28 IN volatile UINT32 *Value
29 )
30 {
31 UINT32 OriginalValue;
32
33 do {
34 OriginalValue = *Value;
35 } while (OriginalValue == InternalSyncCompareExchange32 (
36 Value,
37 OriginalValue,
38 OriginalValue + 1
39 ));
40 return OriginalValue + 1;
41 }
42
43 UINT32
44 EFIAPI
45 InternalSyncDecrement (
46 IN volatile UINT32 *Value
47 )
48 {
49 UINT32 OriginalValue;
50
51 do {
52 OriginalValue = *Value;
53 } while (OriginalValue == InternalSyncCompareExchange32 (
54 Value,
55 OriginalValue,
56 OriginalValue - 1
57 ));
58 return OriginalValue - 1;
59 }