From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alessandro Rubini Date: Thu, 17 Mar 2011 16:30:38 +0100 Subject: [U-Boot] [PATCH] arm: Tegra2: add support for A9 CPU init In-Reply-To: References: <1297887964-25207-1-git-send-email-twarren@nvidia.com> <1297887964-25207-2-git-send-email-twarren@nvidia.com> <1300116820.22456.1641.camel@petert> <1300141233.22456.1699.camel@petert> Message-ID: <20110317153038.GA16665@mail.gnudd.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de >> 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