ARM: convert all "mov.* pc, reg" to "bx reg" for ARMv6+
ARMv6 and greater introduced a new instruction ("bx") which can be used to return from function calls. Recent CPUs perform better when the "bx lr" instruction is used rather than the "mov pc, lr" instruction, and this sequence is strongly recommended to be used by the ARM architecture manual (section A.4.1.1). We provide a new macro "ret" with all its variants for the condition code which will resolve to the appropriate instruction. Rather than doing this piecemeal, and miss some instances, change all the "mov pc" instances to use the new macro, with the exception of the "movs" instruction and the kprobes code. This allows us to detect the "mov pc, lr" case and fix it up - and also gives us the possibility of deploying this for other registers depending on the CPU selection. Reported-by: Will Deacon <will.deacon@arm.com> Tested-by: Stephen Warren <swarren@nvidia.com> # Tegra Jetson TK1 Tested-by: Robert Jarzmik <robert.jarzmik@free.fr> # mioa701_bootresume.S Tested-by: Andrew Lunn <andrew@lunn.ch> # Kirkwood Tested-by: Shawn Guo <shawn.guo@freescale.com> Tested-by: Tony Lindgren <tony@atomide.com> # OMAPs Tested-by: Gregory CLEMENT <gregory.clement@free-electrons.com> # Armada XP, 375, 385 Acked-by: Sekhar Nori <nsekhar@ti.com> # DaVinci Acked-by: Christoffer Dall <christoffer.dall@linaro.org> # kvm/hyp Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com> # PXA3xx Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> # Xen Tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> # ARMv7M Tested-by: Simon Horman <horms+renesas@verge.net.au> # Shmobile Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
@@ -51,14 +51,14 @@
|
||||
*/
|
||||
ENTRY(cpu_arm720_dcache_clean_area)
|
||||
ENTRY(cpu_arm720_proc_init)
|
||||
mov pc, lr
|
||||
ret lr
|
||||
|
||||
ENTRY(cpu_arm720_proc_fin)
|
||||
mrc p15, 0, r0, c1, c0, 0
|
||||
bic r0, r0, #0x1000 @ ...i............
|
||||
bic r0, r0, #0x000e @ ............wca.
|
||||
mcr p15, 0, r0, c1, c0, 0 @ disable caches
|
||||
mov pc, lr
|
||||
ret lr
|
||||
|
||||
/*
|
||||
* Function: arm720_proc_do_idle(void)
|
||||
@@ -66,7 +66,7 @@ ENTRY(cpu_arm720_proc_fin)
|
||||
* Purpose : put the processor in proper idle mode
|
||||
*/
|
||||
ENTRY(cpu_arm720_do_idle)
|
||||
mov pc, lr
|
||||
ret lr
|
||||
|
||||
/*
|
||||
* Function: arm720_switch_mm(unsigned long pgd_phys)
|
||||
@@ -81,7 +81,7 @@ ENTRY(cpu_arm720_switch_mm)
|
||||
mcr p15, 0, r0, c2, c0, 0 @ update page table ptr
|
||||
mcr p15, 0, r1, c8, c7, 0 @ flush TLB (v4)
|
||||
#endif
|
||||
mov pc, lr
|
||||
ret lr
|
||||
|
||||
/*
|
||||
* Function: arm720_set_pte_ext(pte_t *ptep, pte_t pte, unsigned int ext)
|
||||
@@ -94,7 +94,7 @@ ENTRY(cpu_arm720_set_pte_ext)
|
||||
#ifdef CONFIG_MMU
|
||||
armv3_set_pte_ext wc_disable=0
|
||||
#endif
|
||||
mov pc, lr
|
||||
ret lr
|
||||
|
||||
/*
|
||||
* Function: arm720_reset
|
||||
@@ -112,7 +112,7 @@ ENTRY(cpu_arm720_reset)
|
||||
bic ip, ip, #0x000f @ ............wcam
|
||||
bic ip, ip, #0x2100 @ ..v....s........
|
||||
mcr p15, 0, ip, c1, c0, 0 @ ctrl register
|
||||
mov pc, r0
|
||||
ret r0
|
||||
ENDPROC(cpu_arm720_reset)
|
||||
.popsection
|
||||
|
||||
@@ -128,7 +128,7 @@ __arm710_setup:
|
||||
bic r0, r0, r5
|
||||
ldr r5, arm710_cr1_set
|
||||
orr r0, r0, r5
|
||||
mov pc, lr @ __ret (head.S)
|
||||
ret lr @ __ret (head.S)
|
||||
.size __arm710_setup, . - __arm710_setup
|
||||
|
||||
/*
|
||||
@@ -156,7 +156,7 @@ __arm720_setup:
|
||||
mrc p15, 0, r0, c1, c0 @ get control register
|
||||
bic r0, r0, r5
|
||||
orr r0, r0, r6
|
||||
mov pc, lr @ __ret (head.S)
|
||||
ret lr @ __ret (head.S)
|
||||
.size __arm720_setup, . - __arm720_setup
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user