2009/7/22 Javier Martín <lordhab...@gmail.com>: > El mié, 22-07-2009 a las 19:12 +0800, Bean escribió: >> Fix some wrong assumption in types.h and efi header files. For >> example, grub_efi_uint_t is defined as unsigned long, but it should be >> grub_uint64_t in 64-bit EFI, this problem won't show previously as >> unsigned long is 64-bit in elf64 gcc, but it's 32-bit in mingw-w64 >> gcc. > I think you haven't corrected _all_ such assumptions. For example, in > your grub/types.h: > > #if GRUB_CPU_SIZEOF_VOID_P == 8 > # define GRUB_ULONG_MAX 18446744073709551615UL > # define GRUB_LONG_MAX 9223372036854775807L > # define GRUB_LONG_MIN (-9223372036854775807L - 1) > #else > # define GRUB_ULONG_MAX 4294967295UL > # define GRUB_LONG_MAX 2147483647L > # define GRUB_LONG_MIN (-2147483647L - 1) > #endif > > In mingw64, sizeof(void*) = 8, but ULONG_MAX = 2^32-1. > grub/machine/types.h defines a GRUB_TARGET_SIZEOF_LONG that might be > suitable for this. Or am I mixing "target" with "host"?
Hi, Oh, thanks for the note. In fact, we can use GRUB_CPU_SIZEOF_LONG, its value is GRUB_TARGET_SIZEOF_LONG when building target, and SIZEOF_LONG when building utilities. For example, I now define grub_uint64_t as: #if GRUB_CPU_SIZEOF_LONG == 8 typedef unsigned long grub_uint64_t; #else typedef unsigned long long grub_uint64_t; #endif The previous definition is not correct: #if GRUB_CPU_SIZEOF_VOID_P == 8 typedef unsigned long grub_uint64_t; #else typedef unsigned long long grub_uint64_t; #endif As GRUB_CPU_SIZEOF_LONG doesn't necessary equal to GRUB_CPU_SIZEOF_VOID_P. (It actually avoid this by generating an #errror message when GRUB_CPU_SIZEOF_VOID_P != GRUB_CPU_SIZEOF_LONG). -- Bean _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel