On 04/21/2010 09:53 AM, [email protected] wrote: > In Febryary I was testing GRUB for UEFI and noticed that it was simply > crashing. > > See topic > http://lists.gnu.org/archive/html/grub-devel/2010-02/msg00000.html > > At that time I blamed incorrect UEFI implementation on that computer (cause > it worked fine on another one), but now I noticed that when I took off one > memory stick, everything is working fine on that special computer!!!! > > So, it seems that GRUB2 is crashing on computers with 8 gb of memory (or > more?) > > It has been discovered that some EFI implementations contrary to the following sentence from the spec " any memory space defined by the UEFI memory map is identity mapped (virtual address equals physical address). " do not map the post-4G memory. Attached is a possible workaround. Can you test it? > Is it known bug? Are there workarounds? > > > -- > This message was sent on behalf of [email protected] at openSubscriber.com > http://www.opensubscriber.com/messages/[email protected]/topic.html > > > _______________________________________________ > Grub-devel mailing list > [email protected] > http://lists.gnu.org/mailman/listinfo/grub-devel > >
-- Regards Vladimir 'φ-coder/phcoder' Serbinenko
=== modified file 'grub-core/kern/efi/mm.c'
--- grub-core/kern/efi/mm.c 2010-10-16 15:50:48 +0000
+++ grub-core/kern/efi/mm.c 2011-01-04 12:56:14 +0000
@@ -52,13 +52,13 @@
grub_efi_status_t status;
grub_efi_boot_services_t *b;
-#if GRUB_TARGET_SIZEOF_VOID_P < 8
+#if 1
/* Limit the memory access to less than 4GB for 32-bit platforms. */
if (address > 0xffffffff)
return 0;
#endif
-#if GRUB_TARGET_SIZEOF_VOID_P < 8 || defined (MCMODEL_SMALL)
+#if 1
if (address == 0)
{
type = GRUB_EFI_ALLOCATE_MAX_ADDRESS;
@@ -251,7 +251,7 @@
desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size))
{
if (desc->type == GRUB_EFI_CONVENTIONAL_MEMORY
-#if GRUB_TARGET_SIZEOF_VOID_P < 8 || defined (MCMODEL_SMALL)
+#if 1
&& desc->physical_start <= 0xffffffff
#endif
&& desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x100000
@@ -267,7 +267,7 @@
desc->physical_start = 0x100000;
}
-#if GRUB_TARGET_SIZEOF_VOID_P < 8 || defined (MCMODEL_SMALL)
+#if 1
if (BYTES_TO_PAGES (filtered_desc->physical_start)
+ filtered_desc->num_pages
> BYTES_TO_PAGES (0x100000000LL))
=== modified file 'grub-core/lib/efi/relocator.c'
--- grub-core/lib/efi/relocator.c 2010-04-20 16:08:26 +0000
+++ grub-core/lib/efi/relocator.c 2011-01-04 11:02:37 +0000
@@ -62,13 +62,25 @@
(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 @@
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);
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Grub-devel mailing list [email protected] http://lists.gnu.org/mailman/listinfo/grub-devel
