From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=jian.j.wang@intel.com; receiver=edk2-devel@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 22238210FCF45 for ; Mon, 10 Sep 2018 21:47:46 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Sep 2018 21:47:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,358,1531810800"; d="scan'208";a="256147539" Received: from shwdeopenpsi777.ccr.corp.intel.com ([10.239.158.27]) by orsmga005.jf.intel.com with ESMTP; 10 Sep 2018 21:47:32 -0700 From: Jian J Wang To: edk2-devel@lists.01.org Cc: Dandan Bi , Hao A Wu Date: Tue, 11 Sep 2018 12:47:29 +0800 Message-Id: <20180911044729.5020-1-jian.j.wang@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 Subject: [PATCH] UefiCpuPkg/CpuMpPei: suppress compiler complaining X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Sep 2018 04:47:47 -0000 BZ#: https://bugzilla.tianocore.org/show_bug.cgi?id=1166 Cc: Dandan Bi Cc: Hao A Wu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang --- 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