Hi, The EFI memory management code contains a hard-wired limit restricting physical (and virtual, all 1:1 mapped in UEFI) addresses to 32-bit. While this may be the right thing to do on x86, and hasn't caused me any issues on 32-bit ARM, I have received reports of at least two upcoming 64-bit ARM platforms with no RAM in the lower 4GB of physical address space.
A simple fix would be to just stack the ifdefs, but a better one might be to move the define to one of <cpu/efi/memory.h> (which is currently a dummy for all platforms, simply including <efi/memory.h>) or types.h. So, for something compile tested only on arm64: diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c index 6e9dace..5673d23 100644 --- a/grub-core/kern/efi/mm.c +++ b/grub-core/kern/efi/mm.c @@ -32,12 +32,6 @@ #define BYTES_TO_PAGES(bytes) (((bytes) + 0xfff) >> 12) #define PAGES_TO_BYTES(pages) ((pages) << 12) -#if defined (__code_model_large__) || !defined (__x86_64__) -#define MAX_USABLE_ADDRESS 0xffffffff -#else -#define MAX_USABLE_ADDRESS 0x7fffffff -#endif - /* The size of a memory map obtained from the firmware. This must be a multiplier of 4KB. */ #define MEMORY_MAP_SIZE 0x3000 diff --git a/include/grub/arm/types.h b/include/grub/arm/types.h index 4a806d0..612ea57 100644 --- a/include/grub/arm/types.h +++ b/include/grub/arm/types.h @@ -25,6 +25,8 @@ /* The size of long. */ #define GRUB_TARGET_SIZEOF_LONG 4 +#define MAX_USABLE_ADDRESS 0xffffffff + /* currently only support little-endian. */ #undef GRUB_TARGET_WORDS_BIGENDIAN diff --git a/include/grub/arm64/types.h b/include/grub/arm64/types.h index d132c5e..d52967d 100644 --- a/include/grub/arm64/types.h +++ b/include/grub/arm64/types.h @@ -25,6 +25,8 @@ /* The size of long. */ #define GRUB_TARGET_SIZEOF_LONG 8 +#define MAX_USABLE_ADDRESS 0xffffffffffffULL + /* currently only support little-endian. */ #undef GRUB_TARGET_WORDS_BIGENDIAN diff --git a/include/grub/i386/types.h b/include/grub/i386/types.h index c20063f..7fa7917 100644 --- a/include/grub/i386/types.h +++ b/include/grub/i386/types.h @@ -25,6 +25,12 @@ /* The size of long. */ #define GRUB_TARGET_SIZEOF_LONG 4 +#if defined (__code_model_large__) +#define MAX_USABLE_ADDRESS 0xffffffff +#else +#define MAX_USABLE_ADDRESS 0x7fffffff +#endif + /* i386 is little-endian. */ #undef GRUB_TARGET_WORDS_BIGENDIAN diff --git a/include/grub/ia64/types.h b/include/grub/ia64/types.h index 91a546d..8f13cf6 100644 --- a/include/grub/ia64/types.h +++ b/include/grub/ia64/types.h @@ -25,6 +25,8 @@ /* The size of long. */ #define GRUB_TARGET_SIZEOF_LONG 8 +#define MAX_USABLE_ADDRESS 0xffffffff + /* ia64 is little-endian (usually). */ #undef GRUB_TARGET_WORDS_BIGENDIAN diff --git a/include/grub/x86_64/types.h b/include/grub/x86_64/types.h index d53138e..baa31bb 100644 --- a/include/grub/x86_64/types.h +++ b/include/grub/x86_64/types.h @@ -25,6 +25,12 @@ /* The size of long. */ #define GRUB_TARGET_SIZEOF_LONG 8 +#if defined (__code_model_large__) +#define MAX_USABLE_ADDRESS 0xffffffff +#else +#define MAX_USABLE_ADDRESS 0x7fffffff +#endif + /* x86_64 is little-endian. */ #undef GRUB_TARGET_WORDS_BIGENDIAN --- Would a cleaned-up patch of the same be acceptable? / Leif _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel