diff --git a/ChangeLog b/ChangeLog index bba94dfd9..cda79b44a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-01-04 Vladimir Serbinenko + + * grub-core/lib/efi/relocator.c (grub_relocator_firmware_fill_events): + Ignore the memory post-4G. + (grub_relocator_firmware_alloc_region): Additional debug statement. + 2011-01-04 Vladimir Serbinenko * grub-core/kern/emu/getroot.c (grub_util_get_grub_dev): Check md/%s diff --git a/grub-core/lib/efi/relocator.c b/grub-core/lib/efi/relocator.c index fc4de834b..0d346bea3 100644 --- a/grub-core/lib/efi/relocator.c +++ b/grub-core/lib/efi/relocator.c @@ -62,13 +62,25 @@ grub_relocator_firmware_fill_events (struct grub_relocator_mmap_event *events) (char *) desc < ((char *) descs + mmapsize); desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size)) { + grub_uint64_t start = desc->physical_start; + grub_uint64_t end = desc->physical_start + (desc->num_pages << 12); + + /* post-4G addresses are never supported on 32-bit EFI. + Moreover it has been reported that some 64-bit EFI contrary to the + spec don't map post-4G pages. So if you enable post-4G allocations, + map pages manually or check that they are mapped. + */ + if (end >= 0x100000000ULL) + end = 0x100000000ULL; + if (end <= start) + continue; if (desc->type != GRUB_EFI_CONVENTIONAL_MEMORY) continue; events[counter].type = REG_FIRMWARE_START; - events[counter].pos = desc->physical_start; + events[counter].pos = start; counter++; events[counter].type = REG_FIRMWARE_END; - events[counter].pos = desc->physical_start + (desc->num_pages << 12); + events[counter].pos = end; counter++; } @@ -85,6 +97,9 @@ grub_relocator_firmware_alloc_region (grub_addr_t start, grub_size_t size) if (grub_efi_is_finished) return 1; + grub_dprintf ("relocator", "EFI alloc: %llx, %llx\n", + (unsigned long long) start, (unsigned long long) size); + b = grub_efi_system_table->boot_services; status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_ADDRESS, GRUB_EFI_LOADER_DATA, size >> 12, &address);