earlier version of this didn't count for other archs and actually
mapping the unmapped memory above 4GB.

this builds on top of the previous patch (by phcoder) in the series and
hopefully will do all of the above.

Signed-off-by: Paymon MARANDI <pay...@encs.concordia.ca>
---
 grub-core/kern/efi/mm.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c
index 60ac7ed00..34615826d 100644
--- a/grub-core/kern/efi/mm.c
+++ b/grub-core/kern/efi/mm.c
@@ -178,9 +178,18 @@ grub_efi_allocate_pages_real (grub_efi_physical_address_t 
address,
 void *
 grub_efi_allocate_any_pages (grub_efi_uintn_t pages)
 {
-  return grub_efi_allocate_pages_real (GRUB_EFI_MAX_USABLE_ADDRESS,
-                                      pages, GRUB_EFI_ALLOCATE_MAX_ADDRESS,
-                                      GRUB_EFI_LOADER_DATA);
+  void *ret;
+  ret = grub_efi_allocate_pages_real (GRUB_EFI_MAX_USABLE_ADDRESS, pages,
+                                      GRUB_EFI_ALLOCATE_MAX_ADDRESS,
+                                      GRUB_EFI_LOADER_DATA);
+  if (ret == NULL)
+    {
+      grub_errno = GRUB_ERR_NONE;
+      ret = grub_efi_allocate_pages_real (GRUB_EFI_MAX_USABLE_ADDRESS,
+                                         pages, GRUB_EFI_ALLOCATE_ANY_PAGES,
+                                         GRUB_EFI_LOADER_DATA);
+    }
+  return ret;
 }
 
 void *
-- 
2.49.0


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to