summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include
diff options
context:
space:
mode:
authorChristophe Leroy2019-05-03 08:40:15 +0200
committerMichael Ellerman2019-07-05 16:29:50 +0200
commit7f9c929a7ff203eae60b4225bb6824c3eb31796c (patch)
tree074abff01828d66e8b39a7d9592a10c5967235d5 /arch/powerpc/include
parentpowerpc/module64: Fix comment in R_PPC64_ENTRY handling (diff)
downloadkernel-qcow2-linux-7f9c929a7ff203eae60b4225bb6824c3eb31796c.tar.gz
kernel-qcow2-linux-7f9c929a7ff203eae60b4225bb6824c3eb31796c.tar.xz
kernel-qcow2-linux-7f9c929a7ff203eae60b4225bb6824c3eb31796c.zip
powerpc: Move PPC_HA() PPC_HI() and PPC_LO() to ppc-opcode.h
PPC_HA() PPC_HI() and PPC_LO() macros are nice macros. Move them from module64.c to ppc-opcode.h in order to use them in other places. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> [mpe: Clean up formatting in new code, drop duplicates in ftrace.c] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/include')
-rw-r--r--arch/powerpc/include/asm/ppc-opcode.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index 971bdf84f6fc..f544432aef82 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -413,6 +413,15 @@
#define __PPC_RC21 (0x1 << 10)
/*
+ * Both low and high 16 bits are added as SIGNED additions, so if low 16 bits
+ * has high bit set, high 16 bits must be adjusted. These macros do that (stolen
+ * from binutils).
+ */
+#define PPC_LO(v) ((v) & 0xffff)
+#define PPC_HI(v) (((v) >> 16) & 0xffff)
+#define PPC_HA(v) PPC_HI((v) + 0x8000)
+
+/*
* Only use the larx hint bit on 64bit CPUs. e500v1/v2 based CPUs will treat a
* larx with EH set as an illegal instruction.
*/