[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/4] efi: Fix firmware memory allocation to round to 4k pages, no
From: |
Josh Triplett |
Subject: |
[PATCH 1/4] efi: Fix firmware memory allocation to round to 4k pages, not 1k |
Date: |
Tue, 12 Nov 2013 18:26:17 -0800 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
EFI memory allocation operates in 4k pages, but the firmware memory
allocator used 0x3ff in several places rather than 0xfff.
---
ChangeLog entry:
2013-11-13 Josh Triplett <address@hidden>
* 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.
grub-core/mmap/efi/mmap.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/grub-core/mmap/efi/mmap.c b/grub-core/mmap/efi/mmap.c
index 4f17c8b..a77efe8 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)
--
1.8.4.3