Last change
on this file was 99404, checked in by vboxsync, 2 years ago |
Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643
|
-
Property svn:eol-style
set to
native
|
File size:
1.2 KB
|
Line | |
---|
1 | /** @file
|
---|
2 | Force interrupt handler to return with interrupts still disabled.
|
---|
3 |
|
---|
4 | Copyright (C) 2022, Fen Systems Ltd.
|
---|
5 |
|
---|
6 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
7 | **/
|
---|
8 |
|
---|
9 | #include <Library/BaseLib.h>
|
---|
10 | #include <Library/DebugLib.h>
|
---|
11 |
|
---|
12 | #include "Iret.h"
|
---|
13 |
|
---|
14 | /**
|
---|
15 | Force interrupt handler to return with interrupts still disabled.
|
---|
16 |
|
---|
17 | @param SystemContext A pointer to the system context when the
|
---|
18 | interrupt occurred.
|
---|
19 | **/
|
---|
20 | VOID
|
---|
21 | DisableInterruptsOnIret (
|
---|
22 | IN OUT EFI_SYSTEM_CONTEXT SystemContext
|
---|
23 | )
|
---|
24 | {
|
---|
25 | #if defined (MDE_CPU_X64)
|
---|
26 |
|
---|
27 | IA32_EFLAGS32 Rflags;
|
---|
28 |
|
---|
29 | //
|
---|
30 | // Get flags from system context.
|
---|
31 | //
|
---|
32 | Rflags.UintN = SystemContext.SystemContextX64->Rflags;
|
---|
33 | ASSERT (Rflags.Bits.IF);
|
---|
34 |
|
---|
35 | //
|
---|
36 | // Clear interrupts-enabled flag.
|
---|
37 | //
|
---|
38 | Rflags.Bits.IF = 0;
|
---|
39 | SystemContext.SystemContextX64->Rflags = Rflags.UintN;
|
---|
40 |
|
---|
41 | #elif defined (MDE_CPU_IA32)
|
---|
42 |
|
---|
43 | IA32_EFLAGS32 Eflags;
|
---|
44 |
|
---|
45 | //
|
---|
46 | // Get flags from system context.
|
---|
47 | //
|
---|
48 | Eflags.UintN = SystemContext.SystemContextIa32->Eflags;
|
---|
49 | ASSERT (Eflags.Bits.IF);
|
---|
50 |
|
---|
51 | //
|
---|
52 | // Clear interrupts-enabled flag.
|
---|
53 | //
|
---|
54 | Eflags.Bits.IF = 0;
|
---|
55 | SystemContext.SystemContextIa32->Eflags = Eflags.UintN;
|
---|
56 |
|
---|
57 | #else
|
---|
58 |
|
---|
59 | #error "Unsupported CPU"
|
---|
60 |
|
---|
61 | #endif
|
---|
62 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.