12 #include <linux/slab.h>
13 #include <linux/ptrace.h>
16 #include <unit/leds.h>
17 #include <unit/serial.h>
19 #include <asm/serial-regs.h>
34 unsigned long ssp = (
unsigned long) (regs + 1);
125 .gdb_bpt_instr = { 0xff },
126 .flags = KGDB_HW_BREAKPOINT,
129 static const unsigned char mn10300_kgdb_insn_sizes[256] =
132 1, 3, 3, 3, 1, 3, 3, 3, 1, 3, 3, 3, 1, 3, 3, 3,
133 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
134 2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3,
135 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1,
136 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2,
137 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2,
138 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
139 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
140 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2,
141 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2,
142 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2,
143 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2,
144 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 2,
145 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
146 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
147 0, 2, 2, 2, 2, 2, 2, 4, 0, 3, 0, 4, 0, 6, 7, 1
155 static int kgdb_arch_do_singlestep(
struct pt_regs *
regs)
167 size = mn10300_kgdb_insn_sizes[
cur];
180 if (arg >= 0 && arg <= 2)
188 if (regs->
pc == regs->
lar)
237 if (
cur >= 0xf0 &&
cur <= 0xf7) {
240 case 0: x = (
u8 *)regs->
a0;
break;
241 case 1: x = (
u8 *)regs->
a1;
break;
242 case 2: x = (
u8 *)regs->
a2;
break;
243 case 3: x = (
u8 *)regs->
a3;
break;
246 }
else if (
cur == 0xfc) {
252 }
else if (
cur == 0xfd) {
271 if (
cur >= 0xe8 &&
cur <= 0xeb) {
275 if (arg >= 0 && arg <= 3)
329 debugger_local_cache_flushinv_one(x);
351 debugger_local_cache_flushinv_one(x);
352 debugger_local_cache_flushinv_one(y);
360 static bool kgdb_arch_undo_singlestep(
struct pt_regs *regs)
368 if (x == (
u8 *)regs->
pc)
375 debugger_local_cache_flushinv_one(x);
378 if (y == (
u8 *)regs->
pc)
385 debugger_local_cache_flushinv_one(y);
391 kgdb_sstep_thread =
NULL;
402 if (kgdb_sstep_thread == ti) {
403 kgdb_sstep_thread =
NULL;
417 char *remcom_in_buffer,
char *remcom_out_buffer,
423 switch (remcom_in_buffer[0]) {
427 ptr = &remcom_in_buffer[1];
434 if (remcom_in_buffer[0] ==
's') {
435 kgdb_arch_do_singlestep(regs);
454 if (kgdb_arch_undo_singlestep(regs)) {
462 debugger_local_cache_flushinv();
494 debugger_local_cache_flushinv();