* [PATCH v2] MdeModulePkg/Core: Fix build error with old Visual Studio
@ 2017-11-20 5:41 Jian J Wang
2017-11-20 6:15 ` Zeng, Star
0 siblings, 1 reply; 3+ messages in thread
From: Jian J Wang @ 2017-11-20 5:41 UTC (permalink / raw)
To: edk2-devel; +Cc: Star Zeng, Eric Dong, Bi Dandan
> 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 <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Bi Dandan <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
---
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.
- @return VOID.
+ @return An integer containing the guarded memory bitmap.
**/
UINTN
GetGuardedMemoryBits (
@@ -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 == BIT0) || (BitMap == BIT2) || (BitMap == (BIT2 | BIT0)));
}
/**
@@ -519,7 +524,7 @@ IsHeadGuard (
IN EFI_PHYSICAL_ADDRESS Address
)
{
- return (GetGuardedMemoryBits (Address, 2) == 0b10);
+ return (GetGuardedMemoryBits (Address, 2) == BIT1);
}
/**
@@ -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) == BIT0);
}
/**
diff --git a/MdeModulePkg/Core/PiSmmCore/HeapGuard.c b/MdeModulePkg/Core/PiSmmCore/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.
- @return VOID
+ @return An integer containing the guarded memory bitmap.
**/
UINTN
GetGuardedMemoryBits (
@@ -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 == BIT0) || (BitMap == BIT2) || (BitMap == (BIT2 | BIT0)));
}
/**
@@ -531,7 +536,7 @@ IsHeadGuard (
IN EFI_PHYSICAL_ADDRESS Address
)
{
- return (GetGuardedMemoryBits (Address, 2) == 0b10);
+ return (GetGuardedMemoryBits (Address, 2) == BIT1);
}
/**
@@ -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) == BIT0);
}
/**
--
2.14.1.windows.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] MdeModulePkg/Core: Fix build error with old Visual Studio
2017-11-20 5:41 [PATCH v2] MdeModulePkg/Core: Fix build error with old Visual Studio Jian J Wang
@ 2017-11-20 6:15 ` Zeng, Star
2017-11-20 6:36 ` Wang, Jian J
0 siblings, 1 reply; 3+ messages in thread
From: Zeng, Star @ 2017-11-20 6:15 UTC (permalink / raw)
To: Wang, Jian J, edk2-devel@lists.01.org; +Cc: Bi, Dandan, Dong, Eric, Zeng, Star
Please also update the "This patch change them to decimal to fix it" in the commit log accordingly, with that fixed, Reviewed-by: Star Zeng <star.zeng@intel.com>.
Thanks,
Star
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jian J Wang
Sent: Monday, November 20, 2017 1:41 PM
To: edk2-devel@lists.01.org
Cc: Bi, Dandan <dandan.bi@intel.com>; Dong, Eric <eric.dong@intel.com>; Zeng, Star <star.zeng@intel.com>
Subject: [edk2] [PATCH v2] MdeModulePkg/Core: Fix build error with old Visual Studio
> 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 <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Bi Dandan <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
---
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.
- @return VOID.
+ @return An integer containing the guarded memory bitmap.
**/
UINTN
GetGuardedMemoryBits (
@@ -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 == BIT0) || (BitMap == BIT2) || (BitMap == (BIT2 | BIT0)));
}
/**
@@ -519,7 +524,7 @@ IsHeadGuard (
IN EFI_PHYSICAL_ADDRESS Address
)
{
- return (GetGuardedMemoryBits (Address, 2) == 0b10);
+ return (GetGuardedMemoryBits (Address, 2) == BIT1);
}
/**
@@ -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) == BIT0);
}
/**
diff --git a/MdeModulePkg/Core/PiSmmCore/HeapGuard.c b/MdeModulePkg/Core/PiSmmCore/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.
- @return VOID
+ @return An integer containing the guarded memory bitmap.
**/
UINTN
GetGuardedMemoryBits (
@@ -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 == BIT0) || (BitMap == BIT2) || (BitMap == (BIT2 | BIT0)));
}
/**
@@ -531,7 +536,7 @@ IsHeadGuard (
IN EFI_PHYSICAL_ADDRESS Address
)
{
- return (GetGuardedMemoryBits (Address, 2) == 0b10);
+ return (GetGuardedMemoryBits (Address, 2) == BIT1);
}
/**
@@ -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) == BIT0);
}
/**
--
2.14.1.windows.1
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] MdeModulePkg/Core: Fix build error with old Visual Studio
2017-11-20 6:15 ` Zeng, Star
@ 2017-11-20 6:36 ` Wang, Jian J
0 siblings, 0 replies; 3+ messages in thread
From: Wang, Jian J @ 2017-11-20 6:36 UTC (permalink / raw)
To: Zeng, Star, edk2-devel@lists.01.org; +Cc: Bi, Dandan, Dong, Eric
Sure. Thanks.
> -----Original Message-----
> From: Zeng, Star
> Sent: Monday, November 20, 2017 2:16 PM
> To: Wang, Jian J <jian.j.wang@intel.com>; edk2-devel@lists.01.org
> Cc: Bi, Dandan <dandan.bi@intel.com>; Dong, Eric <eric.dong@intel.com>;
> Zeng, Star <star.zeng@intel.com>
> Subject: RE: [edk2] [PATCH v2] MdeModulePkg/Core: Fix build error with old
> Visual Studio
>
> Please also update the "This patch change them to decimal to fix it" in the
> commit log accordingly, with that fixed, Reviewed-by: Star Zeng
> <star.zeng@intel.com>.
>
> Thanks,
> Star
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jian J
> Wang
> Sent: Monday, November 20, 2017 1:41 PM
> To: edk2-devel@lists.01.org
> Cc: Bi, Dandan <dandan.bi@intel.com>; Dong, Eric <eric.dong@intel.com>;
> Zeng, Star <star.zeng@intel.com>
> Subject: [edk2] [PATCH v2] MdeModulePkg/Core: Fix build error with old Visual
> Studio
>
> > 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 <star.zeng@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Bi Dandan <dandan.bi@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
> ---
> 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.
>
> - @return VOID.
> + @return An integer containing the guarded memory bitmap.
> **/
> UINTN
> GetGuardedMemoryBits (
> @@ -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 == BIT0) || (BitMap == BIT2) || (BitMap == (BIT2 | BIT0)));
> }
>
> /**
> @@ -519,7 +524,7 @@ IsHeadGuard (
> IN EFI_PHYSICAL_ADDRESS Address
> )
> {
> - return (GetGuardedMemoryBits (Address, 2) == 0b10);
> + return (GetGuardedMemoryBits (Address, 2) == BIT1);
> }
>
> /**
> @@ -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) == BIT0);
> }
>
> /**
> diff --git a/MdeModulePkg/Core/PiSmmCore/HeapGuard.c
> b/MdeModulePkg/Core/PiSmmCore/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.
>
> - @return VOID
> + @return An integer containing the guarded memory bitmap.
> **/
> UINTN
> GetGuardedMemoryBits (
> @@ -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 == BIT0) || (BitMap == BIT2) || (BitMap == (BIT2 | BIT0)));
> }
>
> /**
> @@ -531,7 +536,7 @@ IsHeadGuard (
> IN EFI_PHYSICAL_ADDRESS Address
> )
> {
> - return (GetGuardedMemoryBits (Address, 2) == 0b10);
> + return (GetGuardedMemoryBits (Address, 2) == BIT1);
> }
>
> /**
> @@ -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) == BIT0);
> }
>
> /**
> --
> 2.14.1.windows.1
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-11-20 6:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-20 5:41 [PATCH v2] MdeModulePkg/Core: Fix build error with old Visual Studio Jian J Wang
2017-11-20 6:15 ` Zeng, Star
2017-11-20 6:36 ` Wang, Jian J
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox