[U-Boot] [PATCH v2 8/9] arm: use thumb interworking returns in libgcc

V, Aneesh aneesh at ti.com
Wed Aug 1 23:11:48 CEST 2012


Hi Allen,

On Wed, Aug 1, 2012 at 1:32 PM, Allen Martin <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>
> ---
>  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.

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?

best regards,
Aneesh


More information about the U-Boot mailing list