Skip to content

Commit d00d762

Browse files
chleroympe
authored andcommitted
powerpc/ppc-opcode: Define and use PPC_RAW_TRAP() and PPC_RAW_TW()
Add and use PPC_RAW_TRAP() instead of opencoding. Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/52c7e522e56a38e3ff0363906919445920005a8f.1657205708.git.christophe.leroy@csgroup.eu
1 parent 7b48377 commit d00d762

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

arch/powerpc/include/asm/ppc-opcode.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,8 @@
581581

582582
#define PPC_RAW_BRANCH(offset) (0x48000000 | PPC_LI(offset))
583583
#define PPC_RAW_BL(offset) (0x48000001 | PPC_LI(offset))
584+
#define PPC_RAW_TW(t0, a, b) (0x7f000008 | ___PPC_RS(t0) | ___PPC_RA(a) | ___PPC_RB(b))
585+
#define PPC_RAW_TRAP() PPC_RAW_TW(31, 0, 0)
584586

585587
/* Deal with instructions that older assemblers aren't aware of */
586588
#define PPC_BCCTR_FLUSH stringify_in_c(.long PPC_INST_BCCTR_FLUSH)

arch/powerpc/include/asm/probes.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
*/
1010
#include <linux/types.h>
1111
#include <asm/disassemble.h>
12+
#include <asm/ppc-opcode.h>
1213

13-
#define BREAKPOINT_INSTRUCTION 0x7fe00008 /* trap */
14+
#define BREAKPOINT_INSTRUCTION PPC_RAW_TRAP() /* trap */
1415

1516
/* Trap definitions per ISA */
1617
#define IS_TW(instr) (((instr) & 0xfc0007fe) == 0x7c000008)

arch/powerpc/xmon/xmon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ struct bpt {
116116
static struct bpt bpts[NBPTS];
117117
static struct bpt dabr[HBP_NUM_MAX];
118118
static struct bpt *iabr;
119-
static unsigned bpinstr = 0x7fe00008; /* trap */
119+
static unsigned int bpinstr = PPC_RAW_TRAP();
120120

121121
#define BP_NUM(bp) ((bp) - bpts + 1)
122122

0 commit comments

Comments
 (0)