[U-Boot] [PATCH v2] arm: build arch memset/memcpy in Thumb2 mode

Stefan Agner stefan at agner.ch
Sun Nov 30 21:07:35 CET 2014


On 2014-11-30 20:33, Simon Glass wrote:
> Hi Stefan,
> 
> On 21 November 2014 at 08:34, Stefan Agner <stefan at agner.ch> wrote:
>> Resynchronize memcpy/memset with kernel and build them explicitly
>> in Thumb2 mode (unified syntax). Those assembler files can be
>> built and linked in ARM mode too, however when calling them from
>> Thumb2 built code, the stack got corrupted and the copy did not
>> succeed (the exact details have not been traced back). Hoever,
>> the Linux kernel builds those files in Thumb2 mode. Hence U-Boot
>> should build them in Thumb2 mode too when CONFIG_SYS_THUMB_BUILD
>> is set.
>>
>> To build the files without warning, some assembler instructions
>> had to be replaced with their UAL compliant variant (thanks
>> Jeroen for this input).
>>
>> To build the file in Thumb2 mode the implicit-it=always option need
>> to be set to generate Thumb2 compliant IT instructions where needed.
>> We add this option to the general AFLAGS when building for Thumb2.
>>
>> Signed-off-by: Stefan Agner <stefan at agner.ch>
>> ---
>> Changes since v1:
>> - Don't set auto-it in AFLAGS
>> - Removed "no-warn-deprecated" warning suppression
>> - Converted non-UAL assembler instructions to their UAL compliant variants
> 
> Reviewed-by: Simon Glass <sjg at chromium.org>
> 
> Tested on pit and found that it fixed the problem with Thumb mode.
> Still works fine in ARM mode.
> 
> Tested-by: Simon Glass <sjg at chromium.org>
> 
> A few nits:
> - typo 'Hoever' in commit message
> - you could mention the Linux commit/release you synced to
> 

Thanks for testing Simon.

The Linux commit/release I synced to was some 3.18-rcX. However, the
relevant files did not change since 3.17, so we can add that as the
synced version.

--
Stefan

>>
>> Tested in ARM and Thumb2 mode on Vybrid SoC. Disassembled the memset/
>> memcpy object files before and after converting the instructions to UAL,
>> the output was identical.
>>
>>  arch/arm/config.mk               |   4 +-
>>  arch/arm/include/asm/assembler.h |  33 ++++++++++--
>>  arch/arm/lib/memcpy.S            |  80 +++++++++++++++++++---------
>>  arch/arm/lib/memset.S            | 112 ++++++++++++++++++++-------------------
>>  4 files changed, 142 insertions(+), 87 deletions(-)
>>
> 
> Regards,
> Simon



More information about the U-Boot mailing list