But what value is expected for 64bit, 0xFFFFFFFF80000000 or 0x0000000080000000?
Will sign bit be extended for upper bits?
On 11.01.2013, at 21:00, Kinney, Michael D wrote:
> Sergey,
>
> The comparison against 0x7fffffff is required due to a UEFI Spec requirement.
> UEFI Specification 2.3.1 Section 6.2 AllocatePages() and AllocatePool() both
> have a MemoryType parameter that is defined as follows:
>
> MemoryType
>
> The type of memory to allocate. The type EFI_MEMORY_TYPE is defined in
> “Related Definitions” below. These memory types are also described in more
> detail in Table 24 and Table 25. Normal allocations (that is, allocations by
> any UEFI application) are of type EfiLoaderData.MemoryType values in the
> range 0x80000000..0xFFFFFFFF are reserved for use by UEFI OS loaders that are
> provided by operating system vendors. The only illegal memory type values are
> those in the range EfiMaxMemoryType..0x7FFFFFFF.
>
> Since we have to be compatible with both 32-bit and 64-bit CPUs, we cannot
> implement logic that depends on an enum being a 32-bit signed value.
>
> There are two ways to address this compiler error:
>
> 1) Disable this compiler warning for this one compiler in tools_def.txt
> 2) Update the sources to perform an unsigned comparison such as:
>
> if ((PoolType >= EfiMaxMemoryType && (UINTN)PoolType <= 0x7fffffff) ||
>
> Best regards,
>
> Mike
>
> From: Sergey Isakov [mailto:isakov...@bk.ru]
> Sent: Friday, January 11, 2013 2:15 AM
> To: edk2-devel@lists.sourceforge.net
> Subject: Re: [edk2] clang compilation error
>
> Ok, UEFI spec is wrong and as we have to follow them we should exclude the
> comparison.
>
> 11.01.2013, в 11:58, Tim Lewis написал(а):
>
>
> Sergey –
>
> It is an enum in the UEFI specification.
>
> Why not just remove the second comparison? Since the enum is an int (for UEFI
> cases), if it is more than or equal to EfiMaxMemoryType, it must be less than
> 0x7fffffff (if it is an int). Otherwise it would be less than 0.
>
> Tim
>
> From: Sergey Isakov [mailto:isakov...@bk.ru]
> Sent: Thursday, January 10, 2013 11:54 PM
> To: edk2-devel@lists.sourceforge.net
> Subject: [edk2] clang compilation error
>
> Hi,
> with clang 3.3 one has the follow
> ----------
> /edk2/MdeModulePkg/Core/Dxe/Mem/Pool.c:188:49: error: comparison of constant
> 2147483647 with expression of type 'EFI_MEMORY_TYPE' is always true
> [-Werror,-Wtautological-constant-out-of-range-compare] if ((PoolType >=
> EfiMaxMemoryType && PoolType <= 0x7fffffff) ||
> ~~~~~~~~ ^ ~~~~~~~~~~
> 1 error generated.
> ----------
> Again, it is enum and sholud not be compared.
> I will propose to make this as UINT32 and change enum list by a set of
> definitions like
> #define EfiACPIMemoryNVS 0x0A
>
> It will be better then mix enum and integer.
> ------------------------------------------------------------------------------
> Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
> much more. Get web development skills now with LearnDevNow -
> 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
> SALE $99.99 this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122812_______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>
> ------------------------------------------------------------------------------
> Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
> much more. Get web development skills now with LearnDevNow -
> 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
> SALE $99.99 this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122812_______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel