From nobody Sun Apr 28 08:33:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1511156475654319.6501049975867; Sun, 19 Nov 2017 21:41:15 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 450DA220757FB; Sun, 19 Nov 2017 21:37:00 -0800 (PST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 B811420349D80 for ; Sun, 19 Nov 2017 21:36:59 -0800 (PST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Nov 2017 21:41:13 -0800 Received: from jwang36-mobl2.ccr.corp.intel.com ([10.239.192.35]) by fmsmga005.fm.intel.com with ESMTP; 19 Nov 2017 21:41:11 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=jian.j.wang@intel.com; receiver=edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,425,1505804400"; d="scan'208";a="177857606" From: Jian J Wang To: edk2-devel@lists.01.org Date: Mon, 20 Nov 2017 13:41:09 +0800 Message-Id: <20171120054109.16560-1-jian.j.wang@intel.com> X-Mailer: git-send-email 2.14.1.windows.1 Subject: [edk2] [PATCH v2] MdeModulePkg/Core: Fix build error with old Visual Studio X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bi Dandan , Eric Dong , Star Zeng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" > v2 > a. Change an incorrect comment on return value > b. Change constants to macros The build error is introduced by following check in: 2930ef9809976ce693d1d377851344c3b06bd926 235a4490c8ce8b6dbac49e6ae3559cb73d6bf620 The Visual Studio older than 2015 doesn't support constant integer in binary format (0bxxx). This patch change them to decimal to fix it. Cc: Star Zeng Cc: Eric Dong Cc: Bi Dandan Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang --- MdeModulePkg/Core/Dxe/Mem/HeapGuard.c | 13 +++++++++---- MdeModulePkg/Core/PiSmmCore/HeapGuard.c | 13 +++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c b/MdeModulePkg/Core/Dxe/= Mem/HeapGuard.c index 98d597b180..752befa44d 100644 --- a/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c +++ b/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c @@ -373,7 +373,7 @@ ClearGuardedMemoryBits ( @param[in] Address Memory address to retrieve from. @param[in] NumberOfPages Number of pages to retrieve. =20 - @return VOID. + @return An integer containing the guarded memory bitmap. **/ UINTN GetGuardedMemoryBits ( @@ -501,8 +501,13 @@ IsGuardPage ( { UINTN BitMap; =20 + // + // There must be at least one guarded page before and/or after given + // address if it's a Guard page. The bitmap pattern should be one of + // 001, 100 and 101 + // BitMap =3D GetGuardedMemoryBits (Address - EFI_PAGE_SIZE, 3); - return ((BitMap =3D=3D 0b001) || (BitMap =3D=3D 0b100) || (BitMap =3D=3D= 0b101)); + return ((BitMap =3D=3D BIT0) || (BitMap =3D=3D BIT2) || (BitMap =3D=3D (= BIT2 | BIT0))); } =20 /** @@ -519,7 +524,7 @@ IsHeadGuard ( IN EFI_PHYSICAL_ADDRESS Address ) { - return (GetGuardedMemoryBits (Address, 2) =3D=3D 0b10); + return (GetGuardedMemoryBits (Address, 2) =3D=3D BIT1); } =20 /** @@ -536,7 +541,7 @@ IsTailGuard ( IN EFI_PHYSICAL_ADDRESS Address ) { - return (GetGuardedMemoryBits (Address - EFI_PAGE_SIZE, 2) =3D=3D 0b01); + return (GetGuardedMemoryBits (Address - EFI_PAGE_SIZE, 2) =3D=3D BIT0); } =20 /** diff --git a/MdeModulePkg/Core/PiSmmCore/HeapGuard.c b/MdeModulePkg/Core/Pi= SmmCore/HeapGuard.c index 6fda9ba430..c7a1408562 100644 --- a/MdeModulePkg/Core/PiSmmCore/HeapGuard.c +++ b/MdeModulePkg/Core/PiSmmCore/HeapGuard.c @@ -385,7 +385,7 @@ ClearGuardedMemoryBits ( @param[in] Address Memory address to retrieve from. @param[in] NumberOfPages Number of pages to retrieve. =20 - @return VOID + @return An integer containing the guarded memory bitmap. **/ UINTN GetGuardedMemoryBits ( @@ -513,8 +513,13 @@ IsGuardPage ( { UINTN BitMap; =20 + // + // There must be at least one guarded page before and/or after given + // address if it's a Guard page. The bitmap pattern should be one of + // 001, 100 and 101 + // BitMap =3D GetGuardedMemoryBits (Address - EFI_PAGE_SIZE, 3); - return ((BitMap =3D=3D 0b001) || (BitMap =3D=3D 0b100) || (BitMap =3D=3D= 0b101)); + return ((BitMap =3D=3D BIT0) || (BitMap =3D=3D BIT2) || (BitMap =3D=3D (= BIT2 | BIT0))); } =20 /** @@ -531,7 +536,7 @@ IsHeadGuard ( IN EFI_PHYSICAL_ADDRESS Address ) { - return (GetGuardedMemoryBits (Address, 2) =3D=3D 0b10); + return (GetGuardedMemoryBits (Address, 2) =3D=3D BIT1); } =20 /** @@ -548,7 +553,7 @@ IsTailGuard ( IN EFI_PHYSICAL_ADDRESS Address ) { - return (GetGuardedMemoryBits (Address - EFI_PAGE_SIZE, 2) =3D=3D 0b01); + return (GetGuardedMemoryBits (Address - EFI_PAGE_SIZE, 2) =3D=3D BIT0); } =20 /** --=20 2.14.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel