* 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.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-10-16 17:44:35 +02:00
parent 24977b4451
commit 65f7ed7c9a
2 changed files with 9 additions and 1 deletions

View file

@ -1,3 +1,8 @@
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.

View file

@ -25,7 +25,7 @@
#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
@ -447,6 +447,9 @@ grub_efi_mm_init (void)
((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");