From: Albert ARIBAUD <albert.aribaud@free.fr>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC] [PATCH] arm: arm926ejs: use ELF relocations
Date: Tue, 05 Oct 2010 08:13:05 +0200 [thread overview]
Message-ID: <4CAAC1F1.2030100@free.fr> (raw)
In-Reply-To: <AANLkTimFS5kJ_vqacEGYi1+UNgf6s_aaqzMmRHLoFgJr@mail.gmail.com>
Le 05/10/2010 07:42, Graeme Russ a ?crit :
> On Tue, Oct 5, 2010 at 4:40 PM, Graeme Russ<graeme.russ@gmail.com> wrote:
>> On Tue, Oct 5, 2010 at 4:34 PM, Wolfgang Denk<wd@denx.de> wrote:
>>> Dear Graeme Russ,
>>>
>>> In message<AANLkTikqE0_DEqHs-tX3A4XuEXJhM0CYW_+j6izhmktw@mail.gmail.com> you wrote:
>>>>
>>>> Can NAND SPL initialise and size memory before loading U-Boot into RAM?
>>>
>>> It has to. You cannot load into and run from uninitialized RAM ;-)
>>>
>>>> If so, could the relocation code be added to NAND SPL so only one copy
>>>> operation is performed?
>>>
>>> I'm afraid it cannot, due to size limitations. The NAND loader often
>>> hast to fit into as little a 2 or 4 KiB...
>>>
>>
>> For x86, the actual relocation calculations can be done in a probably a
>> few dozen bytes of code. It contains:
>>
>> - One offset calculation
>> - A single tight loop
>> - Two comparisons (probably not needed in the generic case as they are used
>> to filter out x86 specific code outside .text)
>> - An offset addition
>>
>> If the only constraint is space then it _may_ be possible in some scenarios
>> (although I do acknowledge that previous trival changes have caused the
>> size constaint to be violated)
>>
>
> Another alternative is to load into upper memory and have the relocation
> code detect that U-Boot is already there and skip the copy operation
The loader would have to know something about the way u-boot relocates
itself, and this may change based on configuration.
For instance, on ARM, if either icache or dcache are configured, u-boot
will reserve the upper 64 KB for TLB and thus relocate 64 KB lower than
if neither icache nor dcache are configured. Ditto for VFD, LCD
framebuffer, etc. Only after these allocations, and thus below them, is
u-boot finally relocated.
An independent loader would thus have to figure all this out in order to
know how exactly where u-boot expects to relocate, otherwise it may put
u-boot at a location which would be almost, but not quite, entirely
unlike the intended one -- and that's the worst possible choice, as we
now hit the dreaded 'relocate over oneself' issue.
OTOH, the u-boot board.c may possibly be modified so that the the final
location of the u-boot code only depend on its code size, not its
configuration options. Something like, in descending order: u-boot code,
data and bss; TLBs, VFDs, framebuffers, etc; malloc arena; and stack.
> Regards,
>
> Graeme
Amicalement,
--
Albert.
next prev parent reply other threads:[~2010-10-05 6:13 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-04 22:01 [U-Boot] [RFC] [PATCH] arm: arm926ejs: use ELF relocations Albert Aribaud
2010-10-04 22:09 ` Albert ARIBAUD
2010-10-04 23:57 ` John Rigby
2010-10-05 0:01 ` Graeme Russ
2010-10-05 5:34 ` Wolfgang Denk
2010-10-05 5:40 ` Graeme Russ
2010-10-05 5:42 ` Graeme Russ
2010-10-05 6:13 ` Albert ARIBAUD [this message]
2010-10-05 5:30 ` Wolfgang Denk
2010-10-05 5:41 ` J. William Campbell
2010-10-05 5:47 ` Albert ARIBAUD
2010-10-04 22:22 ` Graeme Russ
2010-10-04 22:57 ` Albert ARIBAUD
2010-10-04 23:21 ` Graeme Russ
2010-10-05 0:16 ` Albert ARIBAUD
2010-10-05 3:42 ` J. William Campbell
2010-10-04 23:23 ` Graeme Russ
2010-10-04 23:59 ` Albert ARIBAUD
2010-10-05 6:11 ` Wolfgang Denk
-- strict thread matches above, loose matches on Subject: below --
2010-10-05 6:13 Wolfgang Denk
2010-10-05 6:33 ` Albert ARIBAUD
2011-03-29 23:13 du zhigang
2011-03-30 5:06 ` Albert ARIBAUD
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=4CAAC1F1.2030100@free.fr \
--to=albert.aribaud@free.fr \
--cc=u-boot@lists.denx.de \
/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