From: Graeme Russ <graeme.russ@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] x86: Fix how the location of the realmode and bios blobs are calculated
Date: Sat, 12 Nov 2011 21:21:19 +1100 [thread overview]
Message-ID: <4EBE489F.4040806@gmail.com> (raw)
In-Reply-To: <1320790794-21954-1-git-send-email-gabeblack@chromium.org>
Hi Gabe,
On 09/11/11 09:19, Gabe Black wrote:
> There are two blobs embedded into the u-boot image which are linked to run
> at an address which is different from where they actually end up in the
> ROM, one called "realmode" and one called "bios". There are realmode_setup
> and bios_setup functions which prepare those blobs by copying them into the
> location they're supposed to run from, among other things.
>
> During u-boot relocation from ROM to RAM, the text and a few data segments
> are copied over. The realmode and bios sections are not copied, and so the
> only place they can be read from is their original location in the ROM.
> Looking specifically at the bios blob, there are symbols defined in the
> linker script called __bios_start and __bios_size which are defined to be
> the start and size of the blob in the ROM.
>
> In the bios_setup function, there seem to be two mistakes happening. First,
> the offset from ROM to RAM is being added to __bios_start which implies that
> this code expects to use the copy moved to RAM. No such copy is made, so
> that's wrong. More subtly, when u-boot relocates itself, it goes through
> all of the relocations stored in .rel.dyn and fixes them up. This has the
> effect of transforming the __bios_start reference in bios_setup so that it
> refers to the version in RAM (if one existed) instead of the one in ROM. To
> correct for that, the offset actually needs to be subtracted out again to
> translate the address back into the ROM.
>
> The net effect is that for both blobs, a + needs to be changed to a -.
>
> Signed-off-by: Gabe Black <gabeblack@chromium.org>
> ---
> Changes in v2:
> Update x86 tag.
>
> arch/x86/lib/bios_setup.c | 6 +++++-
> arch/x86/lib/realmode.c | 6 +++++-
> 2 files changed, 10 insertions(+), 2 deletions(-)
Can you please rebase against u-boot-x86/master and re-submit
Thanks,
Graeme
next prev parent reply other threads:[~2011-11-12 10:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-08 6:49 [U-Boot] [PATCH] [x86] Fix how the location of the realmode and bios blobs are calculated Gabe Black
2011-11-08 10:28 ` Graeme Russ
2011-11-08 22:19 ` [U-Boot] [PATCH v2] x86: " Gabe Black
2011-11-09 9:58 ` Graeme Russ
2011-11-12 10:21 ` Graeme Russ [this message]
2011-11-13 2:31 ` [U-Boot] [PATCH v3] " Gabe Black
2011-11-13 11:43 ` Graeme Russ
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=4EBE489F.4040806@gmail.com \
--to=graeme.russ@gmail.com \
--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