]> git.baikalelectronics.ru Git - kernel.git/commitdiff
powerpc/ppc-opcode: Define and use PPC_RAW_TRAP() and PPC_RAW_TW()
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Thu, 7 Jul 2022 14:55:15 +0000 (16:55 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 27 Jul 2022 11:36:05 +0000 (21:36 +1000)
Add and use PPC_RAW_TRAP() instead of opencoding.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/52c7e522e56a38e3ff0363906919445920005a8f.1657205708.git.christophe.leroy@csgroup.eu
arch/powerpc/include/asm/ppc-opcode.h
arch/powerpc/include/asm/probes.h
arch/powerpc/xmon/xmon.c

index 89beabf5325cfee3bb2c19a65f9e9479e8eeabb1..5527a955fb4a9bc6df0e132581875dbf9ee63f86 100644 (file)
 
 #define PPC_RAW_BRANCH(offset)         (0x48000000 | PPC_LI(offset))
 #define PPC_RAW_BL(offset)             (0x48000001 | PPC_LI(offset))
+#define PPC_RAW_TW(t0, a, b)           (0x7f000008 | ___PPC_RS(t0) | ___PPC_RA(a) | ___PPC_RB(b))
+#define PPC_RAW_TRAP()                 PPC_RAW_TW(31, 0, 0)
 
 /* Deal with instructions that older assemblers aren't aware of */
 #define        PPC_BCCTR_FLUSH         stringify_in_c(.long PPC_INST_BCCTR_FLUSH)
index 00634e3145e705961776566f485c68514418c874..e77a2ed7d938aa0f76ad78cbe7e5beff273855bc 100644 (file)
@@ -9,8 +9,9 @@
  */
 #include <linux/types.h>
 #include <asm/disassemble.h>
+#include <asm/ppc-opcode.h>
 
-#define BREAKPOINT_INSTRUCTION 0x7fe00008      /* trap */
+#define BREAKPOINT_INSTRUCTION PPC_RAW_TRAP()  /* trap */
 
 /* Trap definitions per ISA */
 #define IS_TW(instr)           (((instr) & 0xfc0007fe) == 0x7c000008)
index f80c714f1d49258793e2c6cdf5deab0a09e57543..26ef3388c24c493cc2dcd67e54c7ae283070f930 100644 (file)
@@ -116,7 +116,7 @@ struct bpt {
 static struct bpt bpts[NBPTS];
 static struct bpt dabr[HBP_NUM_MAX];
 static struct bpt *iabr;
-static unsigned bpinstr = 0x7fe00008;  /* trap */
+static unsigned int bpinstr = PPC_RAW_TRAP();
 
 #define BP_NUM(bp)     ((bp) - bpts + 1)