Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <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

authored by

Christophe Leroy and committed by
Michael Ellerman
d00d762d 7b48377e

+5 -2
+2
arch/powerpc/include/asm/ppc-opcode.h
··· 581 581 582 582 #define PPC_RAW_BRANCH(offset) (0x48000000 | PPC_LI(offset)) 583 583 #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) 584 586 585 587 /* Deal with instructions that older assemblers aren't aware of */ 586 588 #define PPC_BCCTR_FLUSH stringify_in_c(.long PPC_INST_BCCTR_FLUSH)
+2 -1
arch/powerpc/include/asm/probes.h
··· 9 9 */ 10 10 #include <linux/types.h> 11 11 #include <asm/disassemble.h> 12 + #include <asm/ppc-opcode.h> 12 13 13 - #define BREAKPOINT_INSTRUCTION 0x7fe00008 /* trap */ 14 + #define BREAKPOINT_INSTRUCTION PPC_RAW_TRAP() /* trap */ 14 15 15 16 /* Trap definitions per ISA */ 16 17 #define IS_TW(instr) (((instr) & 0xfc0007fe) == 0x7c000008)
+1 -1
arch/powerpc/xmon/xmon.c
··· 116 116 static struct bpt bpts[NBPTS]; 117 117 static struct bpt dabr[HBP_NUM_MAX]; 118 118 static struct bpt *iabr; 119 - static unsigned bpinstr = 0x7fe00008; /* trap */ 119 + static unsigned int bpinstr = PPC_RAW_TRAP(); 120 120 121 121 #define BP_NUM(bp) ((bp) - bpts + 1) 122 122