]>
Commit | Line | Data |
---|---|---|
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 | // Include common header file for this module.\r | |
19 | //\r | |
20 | #include "CommonHeader.h"\r | |
21 | \r | |
22 | /**\r | |
23 | Disables CPU interrupts and returns the interrupt state prior to the disable\r | |
24 | operation.\r | |
25 | \r | |
26 | Disables CPU interrupts and returns the interrupt state prior to the disable\r | |
27 | operation.\r | |
28 | \r | |
29 | @retval TRUE CPU interrupts were enabled on entry to this call.\r | |
30 | @retval FALSE CPU interrupts were disabled on entry to this call.\r | |
31 | \r | |
32 | **/\r | |
33 | BOOLEAN\r | |
34 | EFIAPI\r | |
35 | SaveAndDisableInterrupts (\r | |
36 | VOID\r | |
37 | )\r | |
38 | {\r | |
39 | BOOLEAN InterruptState;\r | |
40 | \r | |
41 | InterruptState = GetInterruptState ();\r | |
42 | DisableInterrupts ();\r | |
43 | return InterruptState;\r | |
44 | }\r | |
45 | \r | |
46 | /**\r | |
47 | Set the current CPU interrupt state.\r | |
48 | \r | |
49 | Sets the current CPU interrupt state to the state specified by\r | |
50 | InterruptState. If InterruptState is TRUE, then interrupts are enabled. If\r | |
51 | InterruptState is FALSE, then interrupts are disabled. InterruptState is\r | |
52 | returned.\r | |
53 | \r | |
54 | @param InterruptState TRUE if interrupts should enabled. FALSE if\r | |
55 | interrupts should be disabled.\r | |
56 | \r | |
57 | @return InterruptState\r | |
58 | \r | |
59 | **/\r | |
60 | BOOLEAN\r | |
61 | EFIAPI\r | |
62 | SetInterruptState (\r | |
63 | IN BOOLEAN InterruptState\r | |
64 | )\r | |
65 | {\r | |
66 | if (InterruptState) {\r | |
67 | EnableInterrupts ();\r | |
68 | } else {\r | |
69 | DisableInterrupts ();\r | |
70 | }\r | |
71 | return InterruptState;\r | |
72 | }\r |