* grub-core/lib/efi/relocator.c (grub_relocator_firmware_fill_events):

Ignore the memory post-4G.
	(grub_relocator_firmware_alloc_region): Additional debug statement.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-01-04 19:08:03 +01:00
parent ebc71d284c
commit 9eae2084f4
2 changed files with 23 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2011-01-04 Vladimir Serbinenko <phcoder@gmail.com>
* 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 <phcoder@gmail.com> 2011-01-04 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/emu/getroot.c (grub_util_get_grub_dev): Check md/%s * grub-core/kern/emu/getroot.c (grub_util_get_grub_dev): Check md/%s

View file

@ -62,13 +62,25 @@ grub_relocator_firmware_fill_events (struct grub_relocator_mmap_event *events)
(char *) desc < ((char *) descs + mmapsize); (char *) desc < ((char *) descs + mmapsize);
desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size)) 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) if (desc->type != GRUB_EFI_CONVENTIONAL_MEMORY)
continue; continue;
events[counter].type = REG_FIRMWARE_START; events[counter].type = REG_FIRMWARE_START;
events[counter].pos = desc->physical_start; events[counter].pos = start;
counter++; counter++;
events[counter].type = REG_FIRMWARE_END; events[counter].type = REG_FIRMWARE_END;
events[counter].pos = desc->physical_start + (desc->num_pages << 12); events[counter].pos = end;
counter++; counter++;
} }
@ -85,6 +97,9 @@ grub_relocator_firmware_alloc_region (grub_addr_t start, grub_size_t size)
if (grub_efi_is_finished) if (grub_efi_is_finished)
return 1; 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; b = grub_efi_system_table->boot_services;
status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_ADDRESS, status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_ADDRESS,
GRUB_EFI_LOADER_DATA, size >> 12, &address); GRUB_EFI_LOADER_DATA, size >> 12, &address);