Skip to contentSkip to conversation

arm: change to use generic sign_extend32() function

RFC New yalin wang 1 participant 1 message Dec 28, 2015 Arm (32-bit)

lore
Share & tools
lore

yalin wang

author
#0 lore raw

RFC 1/1 arm: change to use generic sign_extend32() function

change to use generic sign_extend32() to caaculate branch_displacement.

---
 arch/arm/probes/decode-arm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/arm/probes/decode-arm.c +2 -3
index f72c33a..ff794c0 100644
@@ -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
Signature · 1 line
1.9.1