mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-02 01:19:49 +00:00
583f1b2f10
There is currently a problem that U-Boot can not work on ARMv4 because assembly imlementations of memcpy() and some other functions use "bx lr" instruction that is not available on ARMv4 ("mov pc, lr" should be used instead). A working preprocessor-based solution to this problem is found in arch/arm/lib/relocate.S. Move it to the "ret" macro in arch/arm/include/asm/assembler.h and change all "bx lr" code to "ret lr" in functions that may run on ARMv4. Linux source code deals with this problem in the same manner. v1 -> v2: Comment update. Pointed out by Andre Przywara. Signed-off-by: Sergei Antonov <saproj@gmail.com> CC: Samuel Holland <samuel@sholland.org> CC: Ye Li <ye.li@nxp.com> CC: Simon Glass <sjg@chromium.org> CC: Andre Przywara <andre.przywara@arm.com> CC: Marek Vasut <marex@denx.de> CC: Sean Anderson <sean.anderson@seco.com> CC: Tom Rini <trini@konsulko.com>
36 lines
730 B
ArmAsm
36 lines
730 B
ArmAsm
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
/*
|
|
* (C) 2017 Theobroma Systems Design und Consulting GmbH
|
|
*/
|
|
|
|
#include <config.h>
|
|
#include <asm/assembler.h>
|
|
#include <linux/linkage.h>
|
|
|
|
.pushsection .text.setjmp, "ax"
|
|
ENTRY(setjmp)
|
|
/*
|
|
* A subroutine must preserve the contents of the registers
|
|
* r4-r8, r10, r11 (v1-v5, v7 and v8) and SP (and r9 in PCS
|
|
* variants that designate r9 as v6).
|
|
*/
|
|
mov ip, sp
|
|
stm a1, {v1-v8, ip, lr}
|
|
mov a1, #0
|
|
ret lr
|
|
ENDPROC(setjmp)
|
|
.popsection
|
|
|
|
.pushsection .text.longjmp, "ax"
|
|
ENTRY(longjmp)
|
|
ldm a1, {v1-v8, ip, lr}
|
|
mov sp, ip
|
|
mov a1, a2
|
|
/* If we were passed a return value of zero, return one instead */
|
|
cmp a1, #0
|
|
bne 1f
|
|
mov a1, #1
|
|
1:
|
|
ret lr
|
|
ENDPROC(longjmp)
|
|
.popsection
|