]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ipf/CpuBreakpoint.c
1. Updated SetJump() and LongJump() for IPF
[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 typedef struct {
23 UINT64 Status;
24 UINT64 r9;
25 UINT64 r10;
26 UINT64 r11;
27 } PAL_PROC_RETURN;
28
29 PAL_PROC_RETURN
30 PalCallStatic (
31 IN CONST VOID *PalEntryPoint,
32 IN UINT64 Arg1,
33 IN UINT64 Arg2,
34 IN UINT64 Arg3,
35 IN UINT64 Arg4
36 );
37
38 /**
39 Generates a breakpoint on the CPU.
40
41 Generates a breakpoint on the CPU. The breakpoint must be implemented such
42 that code can resume normal execution after the breakpoint.
43
44 **/
45 VOID
46 EFIAPI
47 CpuBreakpoint (
48 VOID
49 )
50 {
51 __break (0);
52 }
53
54 /**
55 Used to serialize load and store operations.
56
57 All loads and stores that proceed calls to this function are guaranteed to be
58 globally visible when this function returns.
59
60 **/
61 VOID
62 EFIAPI
63 MemoryFence (
64 VOID
65 )
66 {
67 __mfa ();
68 }
69
70 /**
71 Disables CPU interrupts.
72
73 Disables CPU interrupts.
74
75 **/
76 VOID
77 EFIAPI
78 DisableInterrupts (
79 VOID
80 )
81 {
82 _disable ();
83 }
84
85 /**
86 Enables CPU interrupts.
87
88 Enables CPU interrupts.
89
90 **/
91 VOID
92 EFIAPI
93 EnableInterrupts (
94 VOID
95 )
96 {
97 _enable ();
98 }
99
100 /**
101 Retrieves the current CPU interrupt state.
102
103 Retrieves the current CPU interrupt state. Returns TRUE is interrupts are
104 currently enabled. Otherwise returns FALSE.
105
106 @retval TRUE CPU interrupts are enabled.
107 @retval FALSE CPU interrupts are disabled.
108
109 **/
110 BOOLEAN
111 EFIAPI
112 GetInterruptState (
113 VOID
114 )
115 {
116 return FALSE;
117 }
118
119 /**
120 Enables CPU interrupts for the smallest window required to capture any
121 pending interrupts.
122
123 Enables CPU interrupts for the smallest window required to capture any
124 pending interrupts.
125
126 **/
127 VOID
128 EFIAPI
129 EnableDisableInterrupts (
130 VOID
131 )
132 {
133 EnableInterrupts ();
134 DisableInterrupts ();
135 }
136
137 /**
138 Places the CPU in a sleep state until an interrupt is received.
139
140 Places the CPU in a sleep state until an interrupt is received. If interrupts
141 are disabled prior to calling this function, then the CPU will be placed in a
142 sleep state indefinitely.
143
144 **/
145 VOID
146 EFIAPI
147 CpuSleep (
148 VOID
149 )
150 {
151 PalCallStatic (NULL, 29, 0, 0, 0);
152 }