diff --git a/stand/efi/loader/copy.c b/stand/efi/loader/copy.c --- a/stand/efi/loader/copy.c +++ b/stand/efi/loader/copy.c @@ -296,6 +296,14 @@ return (res); } #define EFI_ALLOC_METHOD AllocateMaxAddress +#elif defined(__aarch64__) +/* + * Older kernels only support a 48-bit physical address space, and locore.S + * only supports a 50-bit space. Limit to 48 bits so older kernels can boot + * even if FEAT_LPA2 is supported by the hardware. + */ +#define get_staging_max() ((1ul << 48) - 1) +#define EFI_ALLOC_METHOD AllocateMaxAddress #else #define EFI_ALLOC_METHOD AllocateAnyPages #endif @@ -320,7 +328,9 @@ */ if (running_on_hyperv()) efi_verify_staging_size(&nr_pages); +#endif +#if EFI_ALLOC_METHOD == AllocateMaxAddress staging = get_staging_max(); #endif status = BS->AllocatePages(EFI_ALLOC_METHOD, EfiLoaderCode,