]> git.proxmox.com Git - mirror_edk2.git/commit - UefiCpuPkg/Library/MpInitLib/MpLib.h
UefiCpuPkg/MpInitLib: split wake up buffer into two parts
authorJian J Wang <jian.j.wang@intel.com>
Fri, 29 Dec 2017 01:12:54 +0000 (09:12 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Thu, 18 Jan 2018 09:03:22 +0000 (17:03 +0800)
commitf32bfe6d061420a15bac6083063d227c567e6388
tree5b723eb926942d77f8ac2be232444dd4d7f0e7cf
parent4f10654e04601fe67a750c9b5a4242efd4141569
UefiCpuPkg/MpInitLib: split wake up buffer into two parts

If PcdDxeNxMemoryProtectionPolicy is set to enable protection for memory
of EfiBootServicesCode, EfiConventionalMemory, the BIOS will hang at a page
fault exception during MP initialization.

The root cause is that the AP wake up buffer, which is below 1MB and used
to hold both AP init code and data, is type of EfiConventionalMemory (not
really allocated because of potential conflict with legacy code), and is
marked as non-executable. During the transition from real address mode
to long mode, the AP init code has to enable paging which will then cause
itself a page fault exception because it's just running in non-executable
memory.

The solution is splitting AP wake up buffer into two part: lower part is
still below 1MB and shared with legacy system, higher part is really
allocated memory of BootServicesCode type. The init code in the memory
below 1MB will not enable paging but just switch to protected mode and
jump to higher memory, in which the init code will enable paging and
switch to long mode.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
UefiCpuPkg/Library/MpInitLib/Ia32/MpEqu.inc
UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm
UefiCpuPkg/Library/MpInitLib/MpLib.c
UefiCpuPkg/Library/MpInitLib/MpLib.h
UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
UefiCpuPkg/Library/MpInitLib/X64/MpEqu.inc
UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm