]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/CpuMpPei: fix vs2012 build error
authorJian J Wang <jian.j.wang@intel.com>
Tue, 18 Sep 2018 07:17:11 +0000 (15:17 +0800)
committerJian J Wang <jian.j.wang@intel.com>
Wed, 26 Sep 2018 02:20:33 +0000 (10:20 +0800)
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 <dandan.bi@intel.com>
Cc: Hao A Wu <hao.a.wu@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: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
UefiCpuPkg/CpuMpPei/CpuPaging.c

index bcb942a8e55059fdc2aa6a291be9f84c245a7c67..c7e0822452c0285bc4dc32f91d8cc4aa9de10653 100644 (file)
@@ -554,6 +554,8 @@ SetupStackGuardPage (
   MpInitLibGetNumberOfProcessors(&NumberOfProcessors, NULL);\r
   MpInitLibWhoAmI (&Bsp);\r
   for (Index = 0; Index < NumberOfProcessors; ++Index) {\r
+    StackBase = 0;\r
+\r
     if (Index == Bsp) {\r
       Hob.Raw = GetHobList ();\r
       while ((Hob.Raw = GetNextHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, Hob.Raw)) != NULL) {\r
@@ -570,6 +572,7 @@ SetupStackGuardPage (
       //\r
       MpInitLibStartupThisAP(GetStackBase, Index, NULL, 0, (VOID *)&StackBase, NULL);\r
     }\r
+    ASSERT (StackBase != 0);\r
     //\r
     // Set Guard page at stack base address.\r
     //\r