[U-Boot] RFC: Aligning arch initialisation sequences
Wolfgang Denk
wd at denx.de
Sun Nov 14 16:01:02 CET 2010
Dear Albert ARIBAUD,
In message <4CDFD1AE.1070409 at free.fr> you wrote:
>
> >> There is no way to set aside a register in ARM code for applicative
> >> purposes.
>
> > What exactly do you mean by that?
>
> Use of the 16 ARM registers r0 to r15 in C code is governed by ABIs; we
> use the one known as (GNU) EABI. The compiler will both respect this ABI
> when generating code and assume it is respected by any other code in the
> application.
Well, that just means that your above statement should be completed by
the phrase "as long as we strictly adhere to some specific ABI".
> The GNU EABI is based on the AAPCS which defines the use of registers.
> r0 to r3 are used for call parameters; r4 to r8, r10 and r11 are used
> as local variables; r12 is a scratch register; r13, r14 and 15 are the
> stack pointer, return address holder and program counter respectively.
> None of these registers can be used as a global constant except r9,
> which is indicated as 'plaform-specific' and potentially useable by
> variants of the AAPCS.
>
> One could argue that using r9 to locage GD would constitue such a
> variant, platform-specific use of AAPCS. However, some -gcc) compiler
> switches actually cause the generated code to follow such variants of
> AAPCS and use r9 for specific purposes (some even r10 if r9 is used,
> even though this is not strictly AAPCS compliant) -- and I don't know
> about potential uses by other compilers.
>
> I would thus not favor using r9 for gd access if there is another way.
Traditionally, U-Boot has been using r9 as GOT pointer. And we use r8
as pointer to the global data (which is what the ``register volatile
gd_t *gd asm ("r8")'' means.
We make sure that the compiler respects this use by adding a
"-ffixed-r8" compiler option.
This is perfectly OK, as we don't have to interface in any way with
any strictly EABI conforming code - we are working in a completely
controlled environment and can adjust rules as needed.
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
Knowledge, sir, should be free to all!
-- Harry Mudd, "I, Mudd", stardate 4513.3
More information about the U-Boot
mailing list