]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /** @file\r |
2 | Base Library CPU Functions for all architectures.\r | |
3 | \r | |
4 | Copyright (c) 2006, Intel Corporation<BR>\r | |
5 | All rights reserved. This program and the accompanying materials\r | |
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 | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
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 | |
13 | Module Name: Cpu.c\r | |
14 | \r | |
15 | **/\r | |
16 | \r | |
17 | /**\r | |
18 | Disables CPU interrupts and returns the interrupt state prior to the disable\r | |
19 | operation.\r | |
20 | \r | |
21 | Disables CPU interrupts and returns the interrupt state prior to the disable\r | |
22 | operation.\r | |
23 | \r | |
24 | @retval TRUE CPU interrupts were enabled on entry to this call.\r | |
25 | @retval FALSE CPU interrupts were disabled on entry to this call.\r | |
26 | \r | |
27 | **/\r | |
28 | BOOLEAN\r | |
29 | EFIAPI\r | |
30 | SaveAndDisableInterrupts (\r | |
31 | VOID\r | |
32 | )\r | |
33 | {\r | |
34 | BOOLEAN InterruptState;\r | |
35 | \r | |
36 | InterruptState = GetInterruptState ();\r | |
37 | DisableInterrupts ();\r | |
38 | return InterruptState;\r | |
39 | }\r | |
40 | \r | |
41 | /**\r | |
42 | Set the current CPU interrupt state.\r | |
43 | \r | |
44 | Sets the current CPU interrupt state to the state specified by\r | |
45 | InterruptState. If InterruptState is TRUE, then interrupts are enabled. If\r | |
46 | InterruptState is FALSE, then interrupts are disabled. InterruptState is\r | |
47 | returned.\r | |
48 | \r | |
49 | @param InterruptState TRUE if interrupts should enabled. FALSE if\r | |
50 | interrupts should be disabled.\r | |
51 | \r | |
52 | @return InterruptState\r | |
53 | \r | |
54 | **/\r | |
55 | BOOLEAN\r | |
56 | EFIAPI\r | |
57 | SetInterruptState (\r | |
58 | IN BOOLEAN InterruptState\r | |
59 | )\r | |
60 | {\r | |
61 | if (InterruptState) {\r | |
62 | EnableInterrupts ();\r | |
63 | } else {\r | |
64 | DisableInterrupts ();\r | |
65 | }\r | |
66 | return InterruptState;\r | |
67 | }\r |