On Mon, Dec 09, 2013 at 08:43:57PM +0100, Vladimir 'φ-coder/phcoder' Serbinenko wrote: > If you want to increase it to 0xffffffffffffffff you'll need patch at > bottom of this mail. All other uses of MAX_USABLE_ADDRESS seem to be > fine.
I can limit myself to 48 bits addressing due to current architectural restrictions, so not strictly speaking required, but... > With this patch we would lose the last usable page but it's just > 4K and this page is dangerous for overflows anyway so better to avoid. > I'd suggest using something lower (perhaps 1M lower) to avoid potential > bugs in EFI. ...this certainly looks like a good idea regardless. > diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c > index 6e9dace..2becb7b 100644 > --- a/grub-core/kern/efi/mm.c > +++ b/grub-core/kern/efi/mm.c > @@ -30,6 +30,7 @@ > ((grub_efi_memory_descriptor_t *) ((char *) (desc) + (size))) > > #define BYTES_TO_PAGES(bytes) (((bytes) + 0xfff) >> 12) > +#define BYTES_TO_PAGES_DOWN(bytes) ((bytes) >> 12) > #define PAGES_TO_BYTES(pages) ((pages) << 12) > > #if defined (__code_model_large__) || !defined (__x86_64__) > @@ -343,9 +344,9 @@ filter_memory_map (grub_efi_memory_descriptor_t > *memory_map, > #if 1 > if (BYTES_TO_PAGES (filtered_desc->physical_start) > + filtered_desc->num_pages > - > BYTES_TO_PAGES (MAX_USABLE_ADDRESS+1LL)) > + > BYTES_TO_PAGES_DOWN (MAX_USABLE_ADDRESS)) > filtered_desc->num_pages > - = (BYTES_TO_PAGES (MAX_USABLE_ADDRESS+1LL) > + = (BYTES_TO_PAGES_DOWN (MAX_USABLE_ADDRESS) > - BYTES_TO_PAGES (filtered_desc->physical_start)); > #endif _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel