From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: grub-devel@gnu.org
Subject: Re: [PATCH] Fix module relocation errors on PowerPC
Date: Sat, 29 Oct 2011 11:39:37 +0200 [thread overview]
Message-ID: <4EABC9D9.1010002@gmail.com> (raw)
In-Reply-To: <20111018164940.42101700@kryten>
[-- Attachment #1: Type: text/plain, Size: 2013 bytes --]
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
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]
next prev parent reply other threads:[~2011-10-29 9:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-18 4:48 [PATCH] Fix module relocation errors on PowerPC Anton Blanchard
2011-10-18 5:49 ` Anton Blanchard
2011-10-29 9:39 ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2011-11-03 18:03 ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-11-08 8:57 ` Anton Blanchard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EABC9D9.1010002@gmail.com \
--to=phcoder@gmail.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).