From mboxrd@z Thu Jan 1 00:00:00 1970 From: Allen Martin Date: Wed, 1 Aug 2012 14:55:08 -0700 Subject: [U-Boot] [PATCH v2 8/9] arm: use thumb interworking returns in libgcc In-Reply-To: References: <1343853146-15498-1-git-send-email-amartin@nvidia.com> <1343853146-15498-9-git-send-email-amartin@nvidia.com> Message-ID: <20120801215508.GB1796@nvidia.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed, Aug 01, 2012 at 02:11:48PM -0700, V, Aneesh wrote: > Hi Allen, > > On Wed, Aug 1, 2012 at 1:32 PM, Allen Martin > wrote: > If CONFIG_SYS_THUMB_BUILD is enabled, use thumb interworking return > instructions from libgcc routines, otherwise use ARM returns. > > Signed-off-by: Allen Martin > > --- > arch/arm/include/asm/assembler.h | 10 ++++++++++ > arch/arm/lib/_ashldi3.S | 3 ++- > arch/arm/lib/_ashrdi3.S | 3 ++- > arch/arm/lib/_divsi3.S | 15 +++++++++++---- > arch/arm/lib/_lshrdi3.S | 3 ++- > arch/arm/lib/_modsi3.S | 9 ++++++++- > arch/arm/lib/_udivsi3.S | 8 +++++--- > arch/arm/lib/_umodsi3.S | 18 +++++++++++++++++- > arch/arm/lib/memcpy.S | 10 ++++++++++ > arch/arm/lib/memset.S | 3 ++- > 10 files changed, 69 insertions(+), 13 deletions(-) > > diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h > index 5e4789b..25ece01 100644 > --- a/arch/arm/include/asm/assembler.h > +++ b/arch/arm/include/asm/assembler.h > @@ -13,6 +13,7 @@ > * Do not include any C declarations in this file - it is included by > * assembler source. > */ > +#include > > /* > * Endian independent macros for shifting bytes within registers. > @@ -58,3 +59,12 @@ > * Cache alligned > */ > #define CALGN(code...) code > + > +/* > + * return instruction > + */ > +#ifdef CONFIG_SYS_THUMB_BUILD > +#define RET bx lr > +#else > +#define RET mov pc, lr > > Why not "bx lr" in all cases? In that case you can just replace all the instances of > "mov pc, lr" directly by "bx lr" instead of this macro. That looks cleaner to me. I didn't want to break any older ARM architectures that don't support the bx instruction but use this code. > BTW, as far as I remember when I did this originally my compiler was compiling > all assembly functions in ARM and it was automatically converting "mov pc, lr" to > "bx lr" ,where necessary. Maybe that was just my compiler and I don't remember > the details now. Did you really face any issue with "mov pc, lr" making wrong jumps? Yes, without this change if I disassemble the code I'm seeing it's still a mov instruction and it hangs. -Allen -- nvpublic