public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Alessandro Rubini <rubini-list@gnudd.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] Question about relocation
Date: Mon, 18 Apr 2011 11:16:56 +0200	[thread overview]
Message-ID: <20110418091656.GA15253@mail.gnudd.com> (raw)
In-Reply-To: <4DAB43C5.5010008@aribaud.net>

Me:
>> but the calculation is done to move to end of ram, so dest is always
>> higher than source.

Albert:
> I guess I can live with this if you put a big fat comment in the code to 
> explain *why* the copy is done end-to-beginning, so that if one day the 
> assumption stops holding, readers of the code can tell if they should 
> keep or change the direction.

Actually, I was wrong. Since the display buffer is allocated over
u-boot, we may already be too high.  This never happens for current
boards, which lived before relocation was there (I rember having
lowered the u-boot address to fit a bigger display buffer above it)
but may happen in the future.

So, with the comment the thing may work (like "please for new boards
load it low now that it relocates high by itself").

However, the copy is made in 35 assembly files. Only ARM has 14
almost-identical copies of the code (some of them are really
identical), so I won't dare touching it.

The only thing I can do is not making the copy by forcing dest =
source if we will overlap ourselves, because the assembly will detect
this:

	adr	r0, _start
	cmp	r0, r6
	beq	clear_bss		/* skip relocation */

[I don't understand why here is _start and in C is _TEXT_BASE, which
are different by 0x40 bytes, but it unexpectedly works]

For me it is working, but the code is not clean at all. I'm sending
the patches anyways.  I found the the overwrite was only for the
stack, which is the lowest address in the relocated place, so I
compared some space below the would-be stack with bss_start.

/alessandro

      reply	other threads:[~2011-04-18  9:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-17  1:19 [U-Boot] Question about relocation Alessandro Rubini
2011-04-17 17:04 ` Albert ARIBAUD
2011-04-17 17:57   ` Alessandro Rubini
2011-04-17 18:23     ` Albert ARIBAUD
2011-04-17 19:30       ` Alessandro Rubini
2011-04-17 19:47         ` Albert ARIBAUD
2011-04-18  9:16           ` Alessandro Rubini [this message]

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=20110418091656.GA15253@mail.gnudd.com \
    --to=rubini-list@gnudd.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