Reviewed-by: Eric Dong
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org]
> Sent: Monday, September 3, 2018 11:16 AM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu ; Dong, Eric ; Yao,
> Jiewen ; Laszlo Ersek ; Zeng,
> Star
> Subject: [edk2] [PATCH 3/4] UefiCpuPkg/MpInitLib: fix register restore issue
> in AP wakeup
>
> The conflict issues are introduced by Stack Guard feature enabled for PEI.
>
> The first is CR0 which should be restored after CR3 and CR4.
> Another is TR which should not be passed from BSP to AP during init phase.
>
> Cc: Eric Dong
> Cc: Laszlo Ersek
> Cc: Ruiyu Ni
> Cc: Jiewen Yao
> Cc: Star Zeng
> Cc: "Ware, Ryan R"
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jian J Wang
> ---
> UefiCpuPkg/Library/MpInitLib/MpLib.c | 8 ++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> index 377876643f..709fbc1575 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> @@ -217,9 +217,9 @@ RestoreVolatileRegisters (
>CPUID_VERSION_INFO_EDXVersionInfoEdx;
>IA32_TSS_DESCRIPTOR *Tss;
>
> - AsmWriteCr0 (VolatileRegisters->Cr0);
>AsmWriteCr3 (VolatileRegisters->Cr3);
>AsmWriteCr4 (VolatileRegisters->Cr4);
> + AsmWriteCr0 (VolatileRegisters->Cr0);
>
>if (IsRestoreDr) {
> AsmCpuid (CPUID_VERSION_INFO, NULL, NULL, NULL,
> ); @@ -1558,7 +1558,7 @@ MpInitLibInitialize (
>ApLoopMode = GetApLoopMode ();
>
>//
> - // Save BSP's Control registers for APs
> + // Save BSP's Control registers for APs.
>//
>SaveVolatileRegisters ();
>
> @@ -1656,6 +1656,10 @@ MpInitLibInitialize (
>//
>CopyMem ((VOID *)ApIdtBase, (VOID *)VolatileRegisters.Idtr.Base,
> VolatileRegisters.Idtr.Limit + 1);
>VolatileRegisters.Idtr.Base = ApIdtBase;
> + //
> + // Don't pass BSP's TR to APs to avoid AP init failure.
> + //
> + VolatileRegisters.Tr = 0;
>CopyMem (>CpuData[0].VolatileRegisters,
> , sizeof (VolatileRegisters));
>//
>// Set BSP basic information
> --
> 2.16.2.windows.1
>
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel