linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: yingjoe.chen@mediatek.com (Yingjoe Chen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: alignment: Use is_wide_instruction() to check wide instruction
Date: Fri, 10 Apr 2015 22:05:41 +0800	[thread overview]
Message-ID: <1428674741-5409-1-git-send-email-yingjoe.chen@mediatek.com> (raw)


I first notice the comment is incorrect, then I realize there's another
macro which do exactly the same thing.
Tested with hand written userspace program with a few wide instructions
to make sure this still work as expect.

8<-------------------------------------------------
do_alignment() is using locally added IS_T32() macro to check if an
instruction is a Thumb-2 32 bit instruction. The macro
is_wide_instruction() is doing the same thing, with slightly faster
implementation.
Change to use is_wide_instruction() in do_alignment() and remove
IS_T32().

Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
---
 arch/arm/mm/alignment.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
index 2c0c541..f8e82f5 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -71,10 +71,6 @@
 
 #define BAD_INSTR 	0xdeadc0de
 
-/* Thumb-2 32 bit format per ARMv7 DDI0406A A6.3, either f800h,e800h,f800h */
-#define IS_T32(hi16) \
-	(((hi16) & 0xe000) == 0xe000 && ((hi16) & 0x1800))
-
 static unsigned long ai_user;
 static unsigned long ai_sys;
 static void *ai_sys_last_pc;
@@ -770,7 +766,7 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
 		tinstr = __mem_to_opcode_thumb16(tinstr);
 		if (!fault) {
 			if (cpu_architecture() >= CPU_ARCH_ARMv7 &&
-			    IS_T32(tinstr)) {
+			    is_wide_instruction(tinstr)) {
 				/* Thumb-2 32-bit */
 				u16 tinst2 = 0;
 				fault = probe_kernel_address(ptr + 1, tinst2);
-- 
1.8.1.1.dirty

             reply	other threads:[~2015-04-10 14:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-10 14:05 Yingjoe Chen [this message]
2015-04-13 12:48 ` [PATCH] ARM: alignment: Use is_wide_instruction() to check wide instruction Dave Martin
2015-04-13 14:47   ` Yingjoe Chen
2015-04-13 15:07     ` Dave Martin
2015-05-07  7:03 ` Yingjoe Chen

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=1428674741-5409-1-git-send-email-yingjoe.chen@mediatek.com \
    --to=yingjoe.chen@mediatek.com \
    --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).