From: ard.biesheuvel@linaro.org (Ard Biesheuvel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] ARM: prefer "bx reg" over "mov pc, reg" for all registers
Date: Tue, 21 Apr 2015 11:09:32 +0200 [thread overview]
Message-ID: <1429607372-7598-1-git-send-email-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <1429607205-7501-1-git-send-email-ard.biesheuvel@linaro.org>
Commit 6ebbf2ce437b (ARM: convert all "mov.* pc, reg" to "bx reg"
for ARMv6+) replaced all occurrences of 'mov pc, <reg>' with the
'ret' macro. However, this macro only emits the 'bx' instruction
when used with the 'lr' register, but still uses 'mov pc, <reg>'
for everything else.
Since ARM/Thumb2 interworking is allowed in the static kernel
(i.e., inside vmlinux), this is potentially unsafe, since the mov
instruction will not switch modes based on the Thumb bit.
So instead, emit the 'bx' instruction in all cases, and not just
for the 'lr' register.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
arch/arm/include/asm/assembler.h | 4 ----
1 file changed, 4 deletions(-)
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index 186270b3e194..6dda6e3378ea 100644
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -435,11 +435,7 @@ THUMB( orr \reg , \reg , #PSR_T_BIT )
#if __LINUX_ARM_ARCH__ < 6
mov\c pc, \reg
#else
- .ifeqs "\reg", "lr"
bx\c \reg
- .else
- mov\c pc, \reg
- .endif
#endif
.endm
.endr
--
1.8.3.2
next prev parent reply other threads:[~2015-04-21 9:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-21 9:06 [PATCH 0/2] ARM: honor Thumb bit when calling procinfo setup functions Ard Biesheuvel
2015-04-21 9:09 ` Ard Biesheuvel [this message]
2015-04-21 10:07 ` [PATCH 2/2] ARM: prefer "bx reg" over "mov pc, reg" for all registers Russell King - ARM Linux
2015-04-21 10:08 ` Ard Biesheuvel
2015-04-21 10:07 ` [PATCH 0/2] ARM: honor Thumb bit when calling procinfo setup functions Russell King - ARM Linux
2015-04-21 10:08 ` [PATCH 1/2] ARM: include Thumb2 bit in PROCINFO setup function offset Ard Biesheuvel
2015-04-21 10:13 ` Russell King - ARM Linux
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1429607372-7598-1-git-send-email-ard.biesheuvel@linaro.org \
--to=ard.biesheuvel@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).