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