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:
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:
The type of memory to allocate. The typeEFI_MEMORY_TYPEis defined in Related Definitions below. These memory types are also described in more detail inTable 24andTable 25. Normal allocations (that is, allocations by any UEFI application) are of typeEfiLoaderData.MemoryTypevalues 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 rangeEfiMaxMemoryType..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) ||
From:Sergey Isakov [mailto:firstname.lastname@example.org] Sent:Friday, January 11, 2013 2:15 AM To:email@example.com 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 ():
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.
/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
------------------------------------------------------------------------------ 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 firstname.lastname@example.org https://lists.sourceforge.net/lists/listinfo/edk2-devel