]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Cpu.c
remove unnecessary comments introduced by tools from MdePkg. The regular express...
[mirror_edk2.git] / MdePkg / Library / BaseLib / Cpu.c
1 /** @file
2 Base Library CPU Functions for all architectures.
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
16 #include <BaseLibInternals.h>
17
18
19 /**
20 Disables CPU interrupts and returns the interrupt state prior to the disable
21 operation.
22
23 Disables CPU interrupts and returns the interrupt state prior to the disable
24 operation.
25
26 @retval TRUE CPU interrupts were enabled on entry to this call.
27 @retval FALSE CPU interrupts were disabled on entry to this call.
28
29 **/
30 BOOLEAN
31 EFIAPI
32 SaveAndDisableInterrupts (
33 VOID
34 )
35 {
36 BOOLEAN InterruptState;
37
38 InterruptState = GetInterruptState ();
39 DisableInterrupts ();
40 return InterruptState;
41 }
42
43 /**
44 Set the current CPU interrupt state.
45
46 Sets the current CPU interrupt state to the state specified by
47 InterruptState. If InterruptState is TRUE, then interrupts are enabled. If
48 InterruptState is FALSE, then interrupts are disabled. InterruptState is
49 returned.
50
51 @param InterruptState TRUE if interrupts should enabled. FALSE if
52 interrupts should be disabled.
53
54 @return InterruptState
55
56 **/
57 BOOLEAN
58 EFIAPI
59 SetInterruptState (
60 IN BOOLEAN InterruptState
61 )
62 {
63 if (InterruptState) {
64 EnableInterrupts ();
65 } else {
66 DisableInterrupts ();
67 }
68 return InterruptState;
69 }