From: Jian J Wang Date: Tue, 18 Sep 2018 07:17:11 +0000 (+0800) Subject: UefiCpuPkg/CpuMpPei: fix vs2012 build error X-Git-Tag: edk2-stable201903~981 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=2939283f2df3b8a0871e9bc7b2dd3718146318f4;hp=5267926134d17e86672b84fd57b438f05ffa68e1 UefiCpuPkg/CpuMpPei: fix vs2012 build error REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1166 Visual Studio 2012 will complain uninitialized variable, StackBase, in the CpuPaging.c. This patch adds code to init it to zero and ASSERT check against 0. This is enough since uninit case will only happen during retrieving stack memory via gEfiHobMemoryAllocStackGuid. But this HOB will always be created in advance. Cc: Dandan Bi Cc: Hao A Wu Cc: Eric Dong Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang Reviewed-by: Laszlo Ersek Reviewed-by: Eric Dong --- diff --git a/UefiCpuPkg/CpuMpPei/CpuPaging.c b/UefiCpuPkg/CpuMpPei/CpuPaging.c index bcb942a8e5..c7e0822452 100644 --- a/UefiCpuPkg/CpuMpPei/CpuPaging.c +++ b/UefiCpuPkg/CpuMpPei/CpuPaging.c @@ -554,6 +554,8 @@ SetupStackGuardPage ( MpInitLibGetNumberOfProcessors(&NumberOfProcessors, NULL); MpInitLibWhoAmI (&Bsp); for (Index = 0; Index < NumberOfProcessors; ++Index) { + StackBase = 0; + if (Index == Bsp) { Hob.Raw = GetHobList (); while ((Hob.Raw = GetNextHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, Hob.Raw)) != NULL) { @@ -570,6 +572,7 @@ SetupStackGuardPage ( // MpInitLibStartupThisAP(GetStackBase, Index, NULL, 0, (VOID *)&StackBase, NULL); } + ASSERT (StackBase != 0); // // Set Guard page at stack base address. //