Skip to content

Commit efe4fbb

Browse files
bsingharorampe
authored andcommitted
powerpc/xmon: Add patch_instruction() support for xmon
Move from mwrite() to patch_instruction() for xmon for breakpoint addition and removal. Signed-off-by: Balbir Singh <bsingharora@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent f3eca95 commit efe4fbb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

arch/powerpc/xmon/xmon.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
#include <asm/xive.h>
5454
#include <asm/opal.h>
5555
#include <asm/firmware.h>
56+
#include <asm/code-patching.h>
5657

5758
#ifdef CONFIG_PPC64
5859
#include <asm/hvcall.h>
@@ -837,7 +838,8 @@ static void insert_bpts(void)
837838
store_inst(&bp->instr[0]);
838839
if (bp->enabled & BP_CIABR)
839840
continue;
840-
if (mwrite(bp->address, &bpinstr, 4) != 4) {
841+
if (patch_instruction((unsigned int *)bp->address,
842+
bpinstr) != 0) {
841843
printf("Couldn't write instruction at %lx, "
842844
"disabling breakpoint there\n", bp->address);
843845
bp->enabled &= ~BP_TRAP;
@@ -874,7 +876,8 @@ static void remove_bpts(void)
874876
continue;
875877
if (mread(bp->address, &instr, 4) == 4
876878
&& instr == bpinstr
877-
&& mwrite(bp->address, &bp->instr, 4) != 4)
879+
&& patch_instruction(
880+
(unsigned int *)bp->address, bp->instr[0]) != 0)
878881
printf("Couldn't remove breakpoint at %lx\n",
879882
bp->address);
880883
else

0 commit comments

Comments
 (0)