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 7CC6A220757F8 for ; Sun, 19 Nov 2017 21:38:02 -0800 (PST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Nov 2017 21:42:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,425,1505804400"; d="scan'208";a="175596036" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga005.jf.intel.com with ESMTP; 19 Nov 2017 21:42:15 -0800 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 19 Nov 2017 21:42:15 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx118.amr.corp.intel.com (10.18.116.18) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 19 Nov 2017 21:42:15 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.152]) with mapi id 14.03.0319.002; Mon, 20 Nov 2017 13:42:13 +0800 From: "Wang, Jian J" To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: "Dong, Eric" , "Bi, Dandan" Thread-Topic: [PATCH] MdeModulePkg/Core: Fix build error with old Visual Studio Thread-Index: AQHTYbHOQk6CqiR0Tkm0VxnMO+Rh/6MctedQgAALG6A= Date: Mon, 20 Nov 2017 05:42:12 +0000 Message-ID: References: <20171120034343.10764-1-jian.j.wang@intel.com> <0C09AFA07DD0434D9E2A0C6AEB0483103B9B8306@shsmsx102.ccr.corp.intel.com> In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103B9B8306@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYzRmMmQzYmYtYTdlMi00YmY2LWFjNzYtNDhkYzI2OGQ0MDE1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiI0QWdYajVmVElRSUxWaUo4ZzdvWlNJODlnS2J6cGZpSnRFVlhtTkJKZng4Z0lKMnZHcDVSXC9pNThYY21wZFd1MCJ9 x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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 05:38:02 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Yes, MACRO should be better. It will be updated in v2 patch. Thanks for the= comments. > -----Original Message----- > From: Zeng, Star > Sent: Monday, November 20, 2017 1:04 PM > To: Wang, Jian J ; edk2-devel@lists.01.org > Cc: Dong, Eric ; Bi, Dandan ; > Zeng, Star > Subject: RE: [PATCH] MdeModulePkg/Core: Fix build error with old Visual S= tudio >=20 > How about to use bit instead of decimal, for example BIT0 for 001, BIT2 f= or 100 > and BIT0+BIT2 for 101, etc. >=20 > And please add detailed comments for return value of GetGuardedMemoryBits= (), > it has only VOID currently. >=20 > @return VOID. >=20 >=20 > Thanks, > Star > -----Original Message----- > From: Wang, Jian J > Sent: Monday, November 20, 2017 11:44 AM > To: edk2-devel@lists.01.org > Cc: Zeng, Star ; Dong, Eric ; B= i, > Dandan > Subject: [PATCH] MdeModulePkg/Core: Fix build error with old Visual Studi= o >=20 > The build error is introduced by following check in: > 2930ef9809976ce693d1d377851344c3b06bd926 > 235a4490c8ce8b6dbac49e6ae3559cb73d6bf620 >=20 > The Visual Studio older than 2015 doesn't support constant integer > in binary format (0bxxx). This patch change them to decimal to fix > it. >=20 > 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(-) >=20 > 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; >=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 1) || (BitMap =3D=3D 4) || (BitMap =3D=3D 5)); > } >=20 > /** > @@ -519,7 +524,7 @@ IsHeadGuard ( > IN EFI_PHYSICAL_ADDRESS Address > ) > { > - return (GetGuardedMemoryBits (Address, 2) =3D=3D 0b10); > + return (GetGuardedMemoryBits (Address, 2) =3D=3D 2); > } >=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 1); > } >=20 > /** > 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; >=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 1) || (BitMap =3D=3D 4) || (BitMap =3D=3D 5)); > } >=20 > /** > @@ -531,7 +536,7 @@ IsHeadGuard ( > IN EFI_PHYSICAL_ADDRESS Address > ) > { > - return (GetGuardedMemoryBits (Address, 2) =3D=3D 0b10); > + return (GetGuardedMemoryBits (Address, 2) =3D=3D 2); > } >=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 1); > } >=20 > /** > -- > 2.14.1.windows.1