Joel Stanley | a1fccbf | 2020-06-23 17:25:56 +0930 | [diff] [blame] | 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 | From: "Christopher M. Riedl" <cmr@informatik.wtf> |
| 3 | Date: Sat, 7 Sep 2019 01:11:23 -0500 |
Joel Stanley | 2070d28 | 2021-07-15 17:27:03 +0930 | [diff] [blame^] | 4 | Subject: [PATCH 12/17] powerpc/xmon: Allow listing and clearing breakpoints in |
Joel Stanley | a1fccbf | 2020-06-23 17:25:56 +0930 | [diff] [blame] | 5 | read-only mode |
| 6 | |
| 7 | Read-only mode should not prevent listing and clearing any active |
| 8 | breakpoints. |
| 9 | |
| 10 | Tested-by: Daniel Axtens <dja@axtens.net> |
| 11 | Reviewed-by: Daniel Axtens <dja@axtens.net> |
| 12 | Signed-off-by: Christopher M. Riedl <cmr@informatik.wtf> |
| 13 | Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> |
| 14 | Link: https://lore.kernel.org/r/20190907061124.1947-2-cmr@informatik.wtf |
| 15 | (cherry picked from commit 96664dee5cf1815777286227b09884b4f019727f) |
| 16 | Signed-off-by: Joel Stanley <joel@jms.id.au> |
| 17 | --- |
| 18 | arch/powerpc/xmon/xmon.c | 16 +++++++++++----- |
| 19 | 1 file changed, 11 insertions(+), 5 deletions(-) |
| 20 | |
| 21 | diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c |
| 22 | index 6d130c89fbd8..ab6371aedfcb 100644 |
| 23 | --- a/arch/powerpc/xmon/xmon.c |
| 24 | +++ b/arch/powerpc/xmon/xmon.c |
| 25 | @@ -1096,10 +1096,6 @@ cmds(struct pt_regs *excp) |
| 26 | set_lpp_cmd(); |
| 27 | break; |
| 28 | case 'b': |
| 29 | - if (xmon_is_ro) { |
| 30 | - printf(xmon_ro_msg); |
| 31 | - break; |
| 32 | - } |
| 33 | bpt_cmds(); |
| 34 | break; |
| 35 | case 'C': |
| 36 | @@ -1368,11 +1364,16 @@ bpt_cmds(void) |
| 37 | struct bpt *bp; |
| 38 | |
| 39 | cmd = inchar(); |
| 40 | + |
| 41 | switch (cmd) { |
| 42 | #ifndef CONFIG_PPC_8xx |
| 43 | static const char badaddr[] = "Only kernel addresses are permitted for breakpoints\n"; |
| 44 | int mode; |
| 45 | case 'd': /* bd - hardware data breakpoint */ |
| 46 | + if (xmon_is_ro) { |
| 47 | + printf(xmon_ro_msg); |
| 48 | + break; |
| 49 | + } |
| 50 | if (!ppc_breakpoint_available()) { |
| 51 | printf("Hardware data breakpoint not supported on this cpu\n"); |
| 52 | break; |
| 53 | @@ -1400,6 +1401,10 @@ bpt_cmds(void) |
| 54 | break; |
| 55 | |
| 56 | case 'i': /* bi - hardware instr breakpoint */ |
| 57 | + if (xmon_is_ro) { |
| 58 | + printf(xmon_ro_msg); |
| 59 | + break; |
| 60 | + } |
| 61 | if (!cpu_has_feature(CPU_FTR_ARCH_207S)) { |
| 62 | printf("Hardware instruction breakpoint " |
| 63 | "not supported on this cpu\n"); |
| 64 | @@ -1458,7 +1463,8 @@ bpt_cmds(void) |
| 65 | break; |
| 66 | } |
| 67 | termch = cmd; |
| 68 | - if (!scanhex(&a)) { |
| 69 | + |
| 70 | + if (xmon_is_ro || !scanhex(&a)) { |
| 71 | /* print all breakpoints */ |
| 72 | printf(" type address\n"); |
| 73 | if (dabr.enabled) { |