e1f414b6 |
1 | /** @file\r |
2 | Base Library CPU Functions for all architectures.\r |
3 | \r |
127010dd |
4 | Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r |
bb817c56 |
5 | This program and the accompanying materials\r |
e1f414b6 |
6 | are licensed and made available under the terms and conditions of the BSD License\r |
7 | which accompanies this distribution. The full text of the license may be found at\r |
127010dd |
8 | http://opensource.org/licenses/bsd-license.php.\r |
e1f414b6 |
9 | \r |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r |
12 | \r |
e1f414b6 |
13 | **/\r |
14 | \r |
47fc17d8 |
15 | #include "BaseLibInternals.h"\r |
f734a10a |
16 | \r |
e1f414b6 |
17 | \r |
18 | /**\r |
19 | Disables CPU interrupts and returns the interrupt state prior to the disable\r |
20 | operation.\r |
21 | \r |
e1f414b6 |
22 | @retval TRUE CPU interrupts were enabled on entry to this call.\r |
23 | @retval FALSE CPU interrupts were disabled on entry to this call.\r |
24 | \r |
25 | **/\r |
26 | BOOLEAN\r |
27 | EFIAPI\r |
28 | SaveAndDisableInterrupts (\r |
29 | VOID\r |
30 | )\r |
31 | {\r |
32 | BOOLEAN InterruptState;\r |
33 | \r |
34 | InterruptState = GetInterruptState ();\r |
35 | DisableInterrupts ();\r |
36 | return InterruptState;\r |
37 | }\r |
38 | \r |
39 | /**\r |
40 | Set the current CPU interrupt state.\r |
41 | \r |
42 | Sets the current CPU interrupt state to the state specified by\r |
43 | InterruptState. If InterruptState is TRUE, then interrupts are enabled. If\r |
44 | InterruptState is FALSE, then interrupts are disabled. InterruptState is\r |
45 | returned.\r |
46 | \r |
127010dd |
47 | @param InterruptState TRUE if interrupts should be enabled. FALSE if\r |
e1f414b6 |
48 | interrupts should be disabled.\r |
49 | \r |
9aa049d9 |
50 | @return InterruptState\r |
e1f414b6 |
51 | \r |
52 | **/\r |
53 | BOOLEAN\r |
54 | EFIAPI\r |
55 | SetInterruptState (\r |
56 | IN BOOLEAN InterruptState\r |
57 | )\r |
58 | {\r |
59 | if (InterruptState) {\r |
60 | EnableInterrupts ();\r |
61 | } else {\r |
62 | DisableInterrupts ();\r |
63 | }\r |
64 | return InterruptState;\r |
65 | }\r |