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