Removed duplicate PalCallStatic functions in different libraries. Moved ReadItc and...
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ipf / CpuBreakpoint.c
1 /** @file
2 Base Library CPU functions for 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 **/
14
15 //void __mfa (void);
16
17 #pragma intrinsic (_enable)
18 #pragma intrinsic (_disable)
19 #pragma intrinsic (__break)
20 #pragma intrinsic (__mfa)
21
22
23 /**
24 Generates a breakpoint on the CPU.
25
26 Generates a breakpoint on the CPU. The breakpoint must be implemented such
27 that code can resume normal execution after the breakpoint.
28
29 **/
30 VOID
31 EFIAPI
32 CpuBreakpoint (
33 VOID
34 )
35 {
36 __break (0);
37 }
38
39 /**
40 Used to serialize load and store operations.
41
42 All loads and stores that proceed calls to this function are guaranteed to be
43 globally visible when this function returns.
44
45 **/
46 VOID
47 EFIAPI
48 MemoryFence (
49 VOID
50 )
51 {
52 __mfa ();
53 }
54
55 /**
56 Disables CPU interrupts.
57
58 Disables CPU interrupts.
59
60 **/
61 VOID
62 EFIAPI
63 DisableInterrupts (
64 VOID
65 )
66 {
67 _disable ();
68 }
69
70 /**
71 Enables CPU interrupts.
72
73 Enables CPU interrupts.
74
75 **/
76 VOID
77 EFIAPI
78 EnableInterrupts (
79 VOID
80 )
81 {
82 _enable ();
83 }
84
85 /**
86 Enables CPU interrupts for the smallest window required to capture any
87 pending interrupts.
88
89 Enables CPU interrupts for the smallest window required to capture any
90 pending interrupts.
91
92 **/
93 VOID
94 EFIAPI
95 EnableDisableInterrupts (
96 VOID
97 )
98 {
99 EnableInterrupts ();
100 DisableInterrupts ();
101 }
102
103 /**
104 Places the CPU in a sleep state until an interrupt is received.
105
106 Places the CPU in a sleep state until an interrupt is received. If interrupts
107 are disabled prior to calling this function, then the CPU will be placed in a
108 sleep state indefinitely.
109
110 **/
111 VOID
112 EFIAPI
113 CpuSleep (
114 VOID
115 )
116 {
117 PalCallStatic (NULL, 29, 0, 0, 0);
118 }