+2010-10-16 Vladimir Serbinenko <phcoder@gmail.com>
+
+ * grub-core/kern/efi/mm.c (BYTES_TO_PAGES): Round up instead of down.
+ (grub_efi_mm_init): Take into account the memory map size increase.
+
2010-10-16 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/term/ns8250.c (do_real_config): Set port->broken to 0.
#define NEXT_MEMORY_DESCRIPTOR(desc, size) \
((grub_efi_memory_descriptor_t *) ((char *) (desc) + (size)))
-#define BYTES_TO_PAGES(bytes) ((bytes) >> 12)
+#define BYTES_TO_PAGES(bytes) (((bytes) + 0xfff) >> 12)
#define PAGES_TO_BYTES(pages) ((pages) << 12)
/* The size of a memory map obtained from the firmware. This must be
((grub_efi_physical_address_t) ((grub_addr_t) memory_map),
2 * BYTES_TO_PAGES (MEMORY_MAP_SIZE));
+ /* Freeing/allocating operations may increase memory map size. */
+ map_size += desc_size * 32;
+
memory_map = grub_efi_allocate_pages (0, 2 * BYTES_TO_PAGES (map_size));
if (! memory_map)
grub_fatal ("cannot allocate memory");