[U-Boot] [PATCH] arm: Tegra2: add support for A9 CPU init

Alessandro Rubini rubini-list at gnudd.com
Thu Mar 17 16:30:38 CET 2011


>> It looks like most of your uses are standalone functions that would
>> function just fine on their own.  Is there a reason you prefer to have
>> them in a C-file instead of in an assembly file?

> Just laziness ;)
> I'll move these to a new .S file in the next patchset.

Actually, writing assembly-only C functions is difficul and
error-pronet. I've seen you use "r0" and other registers esplicitly,
but this is not allowed in general.

I once wasted some hours in tracking why a non-submitted port of
u-boot was not working with a newer compiler. The problem was just
that: the new compiler was inlining a void(void) function; the asm
used "r0" and "r1" explicitly, which worked over a function call
but was corrupting data when inlined by the newer and more optimizing
compiler.

While your functions are currently not inlined (or, like cold_boot,
they may be inlined in a place where no register needs to be
preserved), another user may move them to a context where the
semantics are different, for another board or another boot loader.  If
they are in a .S files, they will only be called by "bl" and you know
the rules for register allocation appy. Besides, a _real_ lazy
programmer avoids the extra quotes and \n in the code :)

/alessandro


More information about the U-Boot mailing list