TianoCore EDK2 master
Loading...
Searching...
No Matches
Iret.c
Go to the documentation of this file.
1
9#include <Library/BaseLib.h>
10#include <Library/DebugLib.h>
11
12#include "Iret.h"
13
20VOID
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}
VOID DisableInterruptsOnIret(IN OUT EFI_SYSTEM_CONTEXT SystemContext)
Definition: Iret.c:21
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284