CpuExceptionHandlerLib: Refactored out mSwitchCr3Flag.

This commit is contained in:
Mikhail Krichanov 2025-01-20 16:28:26 +03:00
parent 93625d5489
commit 1f8f6ddc81
3 changed files with 6 additions and 13 deletions
UefiCpuPkg/Library/CpuExceptionHandlerLib

View File

@ -34,7 +34,6 @@ EXCEPTION_ADDRESSES mAddresses;
extern UINTN ExceptionHandlerBase;
extern UINTN ExceptionHandlerEnd;
extern UINT8 mSwitchCr3Flag;
extern UINTN CorePageTable;
/**
@ -203,8 +202,6 @@ GetExceptionAddresses (
VOID
)
{
mSwitchCr3Flag = 1;
return &mAddresses;
}

View File

@ -38,10 +38,6 @@ global ASM_PFX(UserPageTable)
ASM_PFX(UserPageTable):
resq 1
global ASM_PFX(mSwitchCr3Flag)
ASM_PFX(mSwitchCr3Flag):
db 0x0
ALIGN 4096
Padding:
db 0x0
@ -105,7 +101,9 @@ HookAfterStubHeaderEnd:
global ASM_PFX(CommonInterruptEntry)
ASM_PFX(CommonInterruptEntry):
cli
cmp byte [ASM_PFX(mSwitchCr3Flag)], 0
; Check whether User Space process was interrupted.
mov eax, ds
and eax, 3
jz NoCr3Switch
mov eax, cr3
mov [ASM_PFX(UserPageTable)], eax

View File

@ -63,10 +63,6 @@ global ASM_PFX(UserPageTable)
ASM_PFX(UserPageTable):
resq 1
global ASM_PFX(mSwitchCr3Flag)
ASM_PFX(mSwitchCr3Flag):
db 0x0
ALIGN 4096
Padding:
db 0x0
@ -140,7 +136,9 @@ HookAfterStubHeaderEnd:
global ASM_PFX(CommonInterruptEntry)
ASM_PFX(CommonInterruptEntry):
cli
cmp byte [ASM_PFX(mSwitchCr3Flag)], 0
; Check whether User Space process was interrupted.
mov rax, ds
and rax, 3
jz NoCr3Switch
mov rax, cr3
mov [ASM_PFX(UserPageTable)], rax