[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix module relocation errors on PowerPC
From: |
Anton Blanchard |
Subject: |
Re: [PATCH] Fix module relocation errors on PowerPC |
Date: |
Tue, 18 Oct 2011 16:49:40 +1100 |
Hi,
> Modules (and therefore the heap) need to be close to the executable to
> avoid requiring more complicated relocations. This patch uses the same
> method sparc does and puts the heap directly above the executable.
Sparc doesn't appear to claim the heap. Adding this patch on top of the
relocation one fixes things for me on PowerPC.
Any suggestions on the best way to fix it? The non Sparc version of
grub_claim_heap is rather complicated and I'm not sure why it just
doesn't allocate a couple of MB right above the executable. Assuming
we have ~4MB of free space at the address OF loads us is pretty
reasonable to me.
Anton
--
Index: grub/grub-core/kern/ieee1275/init.c
===================================================================
--- grub.orig/grub-core/kern/ieee1275/init.c 2011-10-18 16:30:03.824984376
+1100
+++ grub/grub-core/kern/ieee1275/init.c 2011-10-18 16:38:34.394100481 +1100
@@ -139,8 +139,16 @@ grub_machine_get_bootlocation (char **de
static void
grub_claim_heap (void)
{
- grub_mm_init_region ((void *) (grub_modules_get_end ()
- + GRUB_KERNEL_MACHINE_STACK_SIZE), 0x200000);
+ grub_uint64_t addr, len;
+
+ addr = grub_modules_get_end () + GRUB_KERNEL_MACHINE_STACK_SIZE;
+ len = 0x200000;
+
+ if (grub_claimmap (addr, len) < 0)
+ grub_error (GRUB_ERR_OUT_OF_MEMORY,
+ "failed to claim heap at 0x%llx, len 0x%llx",
+ addr, len);
+ grub_mm_init_region ((void *) (grub_addr_t)addr, len);
}
#else
static void