[U-Boot] [PATCH v2 8/9] arm: use thumb interworking returns in libgcc
V, Aneesh
aneesh at ti.com
Thu Aug 2 00:15:45 CEST 2012
Hi Allen,
On Wed, Aug 1, 2012 at 2:55 PM, Allen Martin <amartin at nvidia.com> wrote:
> 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 <amartin at nvidia.com<mailto:
> amartin at nvidia.com>> 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 <amartin at nvidia.com<mailto:
> amartin at nvidia.com>>
> > ---
> > 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 <config.h>
> >
> > /*
> > * 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.
>
>
Which is earlier than armv4t, right? On quick look it didn't seem there is
anything
older than that in u-boot. But yes, it's perhaps better to be safe.
>
> > 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.
>
>
Ok.
br,
Aneesh
More information about the U-Boot
mailing list