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.20; helo=mga02.intel.com; envelope-from=jian.j.wang@intel.com; receiver=edk2-devel@lists.01.org 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 84E572035A7C2 for ; Sun, 19 Nov 2017 19:39:48 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Nov 2017 19:44:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,424,1505804400"; d="scan'208";a="3689754" Received: from jwang36-mobl2.ccr.corp.intel.com ([10.239.192.35]) by fmsmga004.fm.intel.com with ESMTP; 19 Nov 2017 19:44:00 -0800 From: Jian J Wang To: edk2-devel@lists.01.org Cc: Star Zeng , Eric Dong , Bi Dandan Date: Mon, 20 Nov 2017 11:43:43 +0800 Message-Id: <20171120034343.10764-1-jian.j.wang@intel.com> X-Mailer: git-send-email 2.14.1.windows.1 Subject: [PATCH] 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: , X-List-Received-Date: Mon, 20 Nov 2017 03:39:49 -0000 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 | 11 ++++++++--- MdeModulePkg/Core/PiSmmCore/HeapGuard.c | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c b/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c index 98d597b180..259aa6c500 100644 --- a/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c +++ b/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c @@ -501,8 +501,13 @@ IsGuardPage ( { UINTN BitMap; + // + // 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 = GetGuardedMemoryBits (Address - EFI_PAGE_SIZE, 3); - return ((BitMap == 0b001) || (BitMap == 0b100) || (BitMap == 0b101)); + return ((BitMap == 1) || (BitMap == 4) || (BitMap == 5)); } /** @@ -519,7 +524,7 @@ IsHeadGuard ( IN EFI_PHYSICAL_ADDRESS Address ) { - return (GetGuardedMemoryBits (Address, 2) == 0b10); + return (GetGuardedMemoryBits (Address, 2) == 2); } /** @@ -536,7 +541,7 @@ IsTailGuard ( IN EFI_PHYSICAL_ADDRESS Address ) { - return (GetGuardedMemoryBits (Address - EFI_PAGE_SIZE, 2) == 0b01); + return (GetGuardedMemoryBits (Address - EFI_PAGE_SIZE, 2) == 1); } /** diff --git a/MdeModulePkg/Core/PiSmmCore/HeapGuard.c b/MdeModulePkg/Core/PiSmmCore/HeapGuard.c index 6fda9ba430..676521c489 100644 --- a/MdeModulePkg/Core/PiSmmCore/HeapGuard.c +++ b/MdeModulePkg/Core/PiSmmCore/HeapGuard.c @@ -513,8 +513,13 @@ IsGuardPage ( { UINTN BitMap; + // + // 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 = GetGuardedMemoryBits (Address - EFI_PAGE_SIZE, 3); - return ((BitMap == 0b001) || (BitMap == 0b100) || (BitMap == 0b101)); + return ((BitMap == 1) || (BitMap == 4) || (BitMap == 5)); } /** @@ -531,7 +536,7 @@ IsHeadGuard ( IN EFI_PHYSICAL_ADDRESS Address ) { - return (GetGuardedMemoryBits (Address, 2) == 0b10); + return (GetGuardedMemoryBits (Address, 2) == 2); } /** @@ -548,7 +553,7 @@ IsTailGuard ( IN EFI_PHYSICAL_ADDRESS Address ) { - return (GetGuardedMemoryBits (Address - EFI_PAGE_SIZE, 2) == 0b01); + return (GetGuardedMemoryBits (Address - EFI_PAGE_SIZE, 2) == 1); } /** -- 2.14.1.windows.1