1 | /** @file
|
---|
2 | Base Library CPU Functions for all architectures.
|
---|
3 |
|
---|
4 | Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
---|
5 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
6 |
|
---|
7 | **/
|
---|
8 |
|
---|
9 | #include "BaseLibInternals.h"
|
---|
10 |
|
---|
11 |
|
---|
12 | /**
|
---|
13 | Disables CPU interrupts and returns the interrupt state prior to the disable
|
---|
14 | operation.
|
---|
15 |
|
---|
16 | @retval TRUE CPU interrupts were enabled on entry to this call.
|
---|
17 | @retval FALSE CPU interrupts were disabled on entry to this call.
|
---|
18 |
|
---|
19 | **/
|
---|
20 | BOOLEAN
|
---|
21 | EFIAPI
|
---|
22 | SaveAndDisableInterrupts (
|
---|
23 | VOID
|
---|
24 | )
|
---|
25 | {
|
---|
26 | BOOLEAN InterruptState;
|
---|
27 |
|
---|
28 | InterruptState = GetInterruptState ();
|
---|
29 | DisableInterrupts ();
|
---|
30 | return InterruptState;
|
---|
31 | }
|
---|
32 |
|
---|
33 | /**
|
---|
34 | Set the current CPU interrupt state.
|
---|
35 |
|
---|
36 | Sets the current CPU interrupt state to the state specified by
|
---|
37 | InterruptState. If InterruptState is TRUE, then interrupts are enabled. If
|
---|
38 | InterruptState is FALSE, then interrupts are disabled. InterruptState is
|
---|
39 | returned.
|
---|
40 |
|
---|
41 | @param InterruptState TRUE if interrupts should be enabled. FALSE if
|
---|
42 | interrupts should be disabled.
|
---|
43 |
|
---|
44 | @return InterruptState
|
---|
45 |
|
---|
46 | **/
|
---|
47 | BOOLEAN
|
---|
48 | EFIAPI
|
---|
49 | SetInterruptState (
|
---|
50 | IN BOOLEAN InterruptState
|
---|
51 | )
|
---|
52 | {
|
---|
53 | if (InterruptState) {
|
---|
54 | EnableInterrupts ();
|
---|
55 | } else {
|
---|
56 | DisableInterrupts ();
|
---|
57 | }
|
---|
58 | return InterruptState;
|
---|
59 | }
|
---|