grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Fix module relocation errors on PowerPC


From: Vladimir 'φ-coder/phcoder' Serbinenko
Subject: Re: [PATCH] Fix module relocation errors on PowerPC
Date: Sat, 29 Oct 2011 11:39:37 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20111005 Iceowl/1.0b2 Icedove/3.1.15

On 18.10.2011 07:49, Anton Blanchard wrote:
> 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.
>
This is an eternal course to restrict usable space to supported
relocations. It should be the other way round. I'll prepare a patch for
adding necessary trampolines.
> 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 
>
> _______________________________________________
> Grub-devel mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/grub-devel
>


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]