2 * May be copied or modified under the terms of the GNU General Public
3 * License. See linux/COPYING for more information.
5 * Based on original code by Glenn Engel, Jim Kingdon,
6 * David Grothe <dave@gcom.com>, Tigran Aivazian, <tigran@sco.com> and
7 * Amit S. Kale <akale@veritas.com>
9 * Super-H port based on sh-stub.c (Ben Lee and Steve Chamberlain) by
10 * Henry Bell <henry.bell@st.com>
12 * Header file for low-level support for remote debug using GDB.
19 #include <asm/ptrace.h>
20 #include <asm/cacheflush.h>
22 /* Same as pt_regs but has vbr in place of syscall_nr */
24 unsigned long regs[16];
35 extern char kgdb_in_gdb_mode;
36 extern int kgdb_nofault; /* Ignore bus errors (in gdb mem access) */
37 extern char in_nmi; /* Debounce flag to prevent NMI reentry*/
40 extern int kgdb_portnum;
42 extern char kgdb_parity;
43 extern char kgdb_bits;
45 /* Init and interface stuff */
46 extern int kgdb_init(void);
47 extern int (*kgdb_getchar)(void);
48 extern void (*kgdb_putchar)(int);
51 typedef void (kgdb_debug_hook_t)(struct pt_regs *regs);
52 typedef void (kgdb_bus_error_hook_t)(void);
53 extern kgdb_debug_hook_t *kgdb_debug_hook;
54 extern kgdb_bus_error_hook_t *kgdb_bus_err_hook;
58 void kgdb_console_write(struct console *co, const char *s, unsigned count);
59 extern int kgdb_console_setup(struct console *, char *);
61 /* Prototypes for jmp fns */
63 typedef int jmp_buf[_JBLEN];
64 extern void longjmp(jmp_buf __jmpb, int __retval);
65 extern int setjmp(jmp_buf __jmpb);
67 /* Forced breakpoint */
68 #define breakpoint() __asm__ __volatile__("trapa #0x3c")
70 /* KGDB should be able to flush all kernel text space */
71 #if defined(CONFIG_CPU_SH4)
72 #define kgdb_flush_icache_range(start, end) \
74 __flush_purge_region((void*)(start), (int)(end) - (int)(start));\
75 flush_icache_range((start), (end)); \
78 #define kgdb_flush_icache_range(start, end) do { } while (0)
81 /* Taken from sh-stub.c of GDB 4.18 */
82 static const char hexchars[] = "0123456789abcdef";
84 /* Get high hex bits */
85 static inline char highhex(const int x)
87 return hexchars[(x >> 4) & 0xf];
90 /* Get low hex bits */
91 static inline char lowhex(const int x)
93 return hexchars[x & 0xf];