public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jian J Wang <jian.j.wang@intel.com>
To: edk2-devel@lists.01.org
Cc: Dandan Bi <dandan.bi@intel.com>, Hao A Wu <hao.a.wu@intel.com>
Subject: [PATCH] UefiCpuPkg/CpuMpPei: suppress compiler complaining
Date: Tue, 11 Sep 2018 12:47:29 +0800	[thread overview]
Message-ID: <20180911044729.5020-1-jian.j.wang@intel.com> (raw)

BZ#: https://bugzilla.tianocore.org/show_bug.cgi?id=1166

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
---
 UefiCpuPkg/CpuMpPei/CpuPaging.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/UefiCpuPkg/CpuMpPei/CpuPaging.c b/UefiCpuPkg/CpuMpPei/CpuPaging.c
index bcb942a8e5..a63421a1af 100644
--- a/UefiCpuPkg/CpuMpPei/CpuPaging.c
+++ b/UefiCpuPkg/CpuMpPei/CpuPaging.c
@@ -517,7 +517,7 @@ GetStackBase (
   IN OUT VOID *Buffer
   )
 {
-  EFI_PHYSICAL_ADDRESS    StackBase;
+  volatile EFI_PHYSICAL_ADDRESS   StackBase;
 
   StackBase = (EFI_PHYSICAL_ADDRESS)(UINTN)&StackBase;
   StackBase += BASE_4KB;
@@ -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,12 +572,19 @@ SetupStackGuardPage (
       //
       MpInitLibStartupThisAP(GetStackBase, Index, NULL, 0, (VOID *)&StackBase, NULL);
     }
-    //
-    // Set Guard page at stack base address.
-    //
-    ConvertMemoryPageAttributes(StackBase, EFI_PAGE_SIZE, 0);
-    DEBUG ((DEBUG_INFO, "Stack Guard set at %lx [cpu%lu]!\n",
-            (UINT64)StackBase, (UINT64)Index));
+
+    if (StackBase == 0) {
+      DEBUG ((DEBUG_ERROR, "Stack base address was not found for [cpu%lu]!\n",
+              (UINT64)Index));
+      ASSERT(StackBase != 0);
+    } else {
+      //
+      // Set Guard page at stack base address.
+      //
+      ConvertMemoryPageAttributes(StackBase, EFI_PAGE_SIZE, 0);
+      DEBUG ((DEBUG_INFO, "Stack Guard set at %lx [cpu%lu]!\n",
+              (UINT64)StackBase, (UINT64)Index));
+    }
   }
 
   //
-- 
2.16.2.windows.1



             reply	other threads:[~2018-09-11  4:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-11  4:47 Jian J Wang [this message]
2018-09-11 14:55 ` [PATCH] UefiCpuPkg/CpuMpPei: suppress compiler complaining Laszlo Ersek
2018-09-12  0:23   ` Wang, Jian J

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180911044729.5020-1-jian.j.wang@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox