linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: yalin.wang2010@gmail.com (yalin wang)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC] arm: change to use generic sign_extend32() function
Date: Mon, 28 Dec 2015 15:07:35 +0800	[thread overview]
Message-ID: <1451286455-13121-1-git-send-email-yalin.wang2010@gmail.com> (raw)

change to use generic sign_extend32() to caaculate branch_displacement.

Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
---
 arch/arm/probes/decode-arm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/arm/probes/decode-arm.c b/arch/arm/probes/decode-arm.c
index f72c33a..ff794c0 100644
--- a/arch/arm/probes/decode-arm.c
+++ b/arch/arm/probes/decode-arm.c
@@ -20,13 +20,12 @@
 #include <linux/module.h>
 #include <linux/stddef.h>
 #include <linux/ptrace.h>
+#include <linux/bitops.h>
 
 #include "decode.h"
 #include "decode-arm.h"
 
-#define sign_extend(x, signbit) ((x) | (0 - ((x) & (1 << (signbit)))))
-
-#define branch_displacement(insn) sign_extend(((insn) & 0xffffff) << 2, 25)
+#define branch_displacement(insn) sign_extend32(((insn) & 0xffffff) << 2, 25)
 
 /*
  * To avoid the complications of mimicing single-stepping on a
-- 
1.9.1

                 reply	other threads:[~2015-12-28  7:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1451286455-13121-1-git-send-email-yalin.wang2010@gmail.com \
    --to=yalin.wang2010@gmail.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).