From ffb8481ba81b142f85204725344d9517e53fd978 Mon Sep 17 00:00:00 2001 From: Dun Tan Date: Fri, 10 May 2024 11:59:25 +0800 Subject: UefiCpuPkg: Disable PG in IA32 ApLoopCode Disable paging in IA32 RelocateApLoop assembly code to fix the issue that the AP page table is unavailiable after boot OS under IA32 execution mode. This issue exist in IA32 PEI + IA32 DXE normal boot (also S3 boot with IA32 PEI after previous three commits are accepted). In current MpLib code, the IA32 execution mode code did not create page table in reserved memory like what X64 code did. If PcdCpuStackGuard is TRUE, the PG is enabled for AP in current RelocateApLoop assembly code. And the page table for AP is unavailiable after boot OS. This might cause potential issue. So disable PG in IA32 RelocateApLoop. Signed-off-by: Dun Tan Reviewed-by: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Reviewed-by: Jiaxin Wu --- UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'UefiCpuPkg/Library') diff --git a/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm b/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm index d117f09ef5..c0fe631635 100644 --- a/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm +++ b/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm @@ -1,5 +1,5 @@ ;------------------------------------------------------------------------------ ; -; Copyright (c) 2015 - 2023, Intel Corporation. All rights reserved.
+; Copyright (c) 2015 - 2024, Intel Corporation. All rights reserved.
; SPDX-License-Identifier: BSD-2-Clause-Patent ; ; Module Name: @@ -225,6 +225,10 @@ RendezvousFunnelProcEnd: ; specific to SEV-ES support and are not applicable on IA32. ;------------------------------------------------------------------------------------- AsmRelocateApLoopGenericStart: + mov eax, cr0 + btr eax, 31 ; Clear CR0.PG + mov cr0, eax ; Disable paging since the page table might be unavailiable + mov eax, esp mov esp, [eax + 12] ; TopOfApStack push dword [eax] ; push return address for stack trace -- cgit v1.2.3