From d53f4900d7a5df63614c15315d413cb1d2e7a34a Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Mon, 18 Nov 2013 18:00:52 +0100 Subject: [PATCH] * grub-core/mmap/efi/mmap.c (grub_mmap_register): Round up/down to 4k page boundaries as expected by firmware rather than 1k boundaries. (grub_mmap_malign_and_register): Likewise. --- ChangeLog | 7 +++++++ grub-core/mmap/efi/mmap.c | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index aee611641..ca8ea2e5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-11-18 Josh Triplett + + * grub-core/mmap/efi/mmap.c (grub_mmap_register): Round up/down to + 4k page boundaries as expected by firmware rather than 1k + boundaries. + (grub_mmap_malign_and_register): Likewise. + 2013-11-18 Vladimir Serbinenko * tests/grub_func_test.in: Decrease RAM size to 512M. With less diff --git a/grub-core/mmap/efi/mmap.c b/grub-core/mmap/efi/mmap.c index 4f17c8b53..a77efe81d 100644 --- a/grub-core/mmap/efi/mmap.c +++ b/grub-core/mmap/efi/mmap.c @@ -184,8 +184,8 @@ grub_mmap_register (grub_uint64_t start, grub_uint64_t size, int type) return 0; b = grub_efi_system_table->boot_services; - address = start & (~0x3ffULL); - pages = (end - address + 0x3ff) >> 12; + address = start & (~0xfffULL); + pages = (end - address + 0xfff) >> 12; status = efi_call_2 (b->free_pages, address, pages); if (status != GRUB_EFI_SUCCESS && status != GRUB_EFI_NOT_FOUND) { @@ -263,7 +263,7 @@ grub_mmap_malign_and_register (grub_uint64_t align __attribute__ ((unused)), atype = GRUB_EFI_ALLOCATE_ANY_PAGES; #endif - pages = (size + 0x3ff) >> 12; + pages = (size + 0xfff) >> 12; status = efi_call_4 (b->allocate_pages, atype, make_efi_memtype (type), pages, &address); if (status != GRUB_EFI_SUCCESS)