From mboxrd@z Thu Jan 1 00:00:00 1970 From: Albert ARIBAUD Date: Mon, 13 Jan 2014 10:07:50 +0100 Subject: [U-Boot] [PATCH] arm: New stack pointer is already aligned In-Reply-To: <20131129061413.52BD4380401@gemini.denx.de> References: <1385580930-9830-1-git-send-email-trini@ti.com> <20131129061413.52BD4380401@gemini.denx.de> Message-ID: <20140113100750.10a3be2e@lilith> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Wolfgang, On Fri, 29 Nov 2013 07:14:13 +0100, Wolfgang Denk wrote: > Dear Tom Rini, > > In message <1385580930-9830-1-git-send-email-trini@ti.com> you wrote: > > The code in arch/arm/lib/board.c::board_init_f that sets > > gd->start_addr_sp has already make sure we're 8-byte aligned, so we > > don't need to do that again. > > > > Cc: Albert ARIBAUD > > Signed-off-by: Tom Rini > > --- > > arch/arm/lib/crt0.S | 1 - > > 1 file changed, 1 deletion(-) > > > > diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S > > index ac54b93..6b5ec01 100644 > > --- a/arch/arm/lib/crt0.S > > +++ b/arch/arm/lib/crt0.S > > @@ -82,7 +82,6 @@ ENTRY(_main) > > */ > > > > ldr sp, [r9, #GD_START_ADDR_SP] /* sp = gd->start_addr_sp */ > > - bic sp, sp, #7 /* 8-byte alignment for ABI compliance */ > > ldr r9, [r9, #GD_BD] /* r9 = gd->bd */ > > sub r9, r9, #GD_SIZE /* new GD is below bd */ > > I recommend to keep this instruction. It's just a bit of defensive > programming, and removing it does not save any measurable amount of > memory footprint nor execution time. I would even go further: it is the setting of SP in C code which should not be kept. I doubt the C specification mentions what should / might happen when changing the stack pointer on the fly in code which might need the stack at any point. > Best regards, > > Wolfgang Denk Amicalement, -- Albert.