[U-Boot] RFC: Aligning arch initialisation sequences

Wolfgang Denk wd at denx.de
Sat Nov 13 09:17:12 CET 2010


Dear Reinhard Meyer,

In message <4CDE30CF.9010509 at emk-elektronik.de> you wrote:
>
> I *personally* prefer code without tool-chain specific, out of "C"
> constructs. So I would be fine with passing gd as a parameter to all

I think you would quickly find this becoming a pretty serious pain.

I've been there before. I used this, or tried to use this, before I
diged out the technique to reserve a register. This issuch a
non-standard mechanism that I hesitated for a long time if doing
something like that was acceptable. But otherwise code size will
explode: tiny functions, which now are a mere few bytes, wil triple
their size and more, because they need to savce registers, load gd
from an argument, and pass it as argument to all called functions.
You will find you have to add gd as argument basicly to _all_
functions in the code, because these my call another function (which
does not use gd), etc. and then, 4 or 5 or evven more levels down
there is a single function that needs to access gd.

It is ugly, and a serious pain.

> pre-relocation functions. The way they are called with a function array

There are no pure pre-location functions. They gt reused after
relocation. And evenbefore relocation you run things like printf()
and so on, and it is a nightmare to add gd arguments to all tehs
estandard functions.

Been there, and quickly left.

> that would probably only marginally increase code size. And instead of

Heh. Try it out, before making such statements.

> all the funky stack calculations to get the space for gd, it could be
> achieved in a much simpler way:

I would be happy if you were right. But you would have to come up
with patches that demonstrate that your claims are actually correct
to make me change my mind.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Unix is supported by IBM, like a hanging man is supported by rope.
		        - Don Libes & Sandy Ressler: _Life With Unix_


More information about the U-Boot mailing list