diff options
author | Paul Mundt <lethal@linux-sh.org> | 2008-12-11 04:46:46 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-12-22 04:44:04 -0500 |
commit | ab6e570ba33dbee18c2520d386e0f367a9b573c3 (patch) | |
tree | 7594192d10726e72bf7744bb83bdc0c9a30891d1 /arch/sh/include/asm/kgdb.h | |
parent | d7b01f78a3ae6a3cc21a16a1a3d377adc2227537 (diff) |
sh: Generic kgdb stub support.
This migrates from the old bitrotted kgdb stub implementation and moves
to the generic stub. In the process support for SH-2/SH-2A is also added,
which the old stub never provided.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/include/asm/kgdb.h')
-rw-r--r-- | arch/sh/include/asm/kgdb.h | 66 |
1 files changed, 19 insertions, 47 deletions
diff --git a/arch/sh/include/asm/kgdb.h b/arch/sh/include/asm/kgdb.h index 24e42078f36f..72704ed725e5 100644 --- a/arch/sh/include/asm/kgdb.h +++ b/arch/sh/include/asm/kgdb.h | |||
@@ -1,21 +1,7 @@ | |||
1 | /* | 1 | #ifndef __ASM_SH_KGDB_H |
2 | * May be copied or modified under the terms of the GNU General Public | 2 | #define __ASM_SH_KGDB_H |
3 | * License. See linux/COPYING for more information. | ||
4 | * | ||
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> | ||
8 | * | ||
9 | * Super-H port based on sh-stub.c (Ben Lee and Steve Chamberlain) by | ||
10 | * Henry Bell <henry.bell@st.com> | ||
11 | * | ||
12 | * Header file for low-level support for remote debug using GDB. | ||
13 | * | ||
14 | */ | ||
15 | |||
16 | #ifndef __KGDB_H | ||
17 | #define __KGDB_H | ||
18 | 3 | ||
4 | #include <asm/cacheflush.h> | ||
19 | #include <asm/ptrace.h> | 5 | #include <asm/ptrace.h> |
20 | 6 | ||
21 | /* Same as pt_regs but has vbr in place of syscall_nr */ | 7 | /* Same as pt_regs but has vbr in place of syscall_nr */ |
@@ -30,40 +16,26 @@ struct kgdb_regs { | |||
30 | unsigned long vbr; | 16 | unsigned long vbr; |
31 | }; | 17 | }; |
32 | 18 | ||
33 | /* State info */ | 19 | enum regnames { |
34 | extern char kgdb_in_gdb_mode; | 20 | GDB_R0, GDB_R1, GDB_R2, GDB_R3, GDB_R4, GDB_R5, GDB_R6, GDB_R7, |
35 | extern int kgdb_nofault; /* Ignore bus errors (in gdb mem access) */ | 21 | GDB_R8, GDB_R9, GDB_R10, GDB_R11, GDB_R12, GDB_R13, GDB_R14, GDB_R15, |
36 | extern char in_nmi; /* Debounce flag to prevent NMI reentry*/ | ||
37 | 22 | ||
38 | /* SCI */ | 23 | GDB_PC, GDB_PR, GDB_SR, GDB_GBR, GDB_MACH, GDB_MACL, GDB_VBR, |
39 | extern int kgdb_portnum; | 24 | }; |
40 | extern int kgdb_baud; | ||
41 | extern char kgdb_parity; | ||
42 | extern char kgdb_bits; | ||
43 | 25 | ||
44 | /* Init and interface stuff */ | 26 | #define NUMREGBYTES ((GDB_VBR + 1) * 4) |
45 | extern int kgdb_init(void); | ||
46 | extern int (*kgdb_getchar)(void); | ||
47 | extern void (*kgdb_putchar)(int); | ||
48 | 27 | ||
49 | /* Trap functions */ | 28 | static inline void arch_kgdb_breakpoint(void) |
50 | typedef void (kgdb_debug_hook_t)(struct pt_regs *regs); | 29 | { |
51 | typedef void (kgdb_bus_error_hook_t)(void); | 30 | __asm__ __volatile__ ("trapa #0x3c\n"); |
52 | extern kgdb_debug_hook_t *kgdb_debug_hook; | 31 | } |
53 | extern kgdb_bus_error_hook_t *kgdb_bus_err_hook; | ||
54 | 32 | ||
55 | /* Console */ | 33 | /* State info */ |
56 | struct console; | 34 | extern char in_nmi; /* Debounce flag to prevent NMI reentry*/ |
57 | void kgdb_console_write(struct console *co, const char *s, unsigned count); | ||
58 | extern int kgdb_console_setup(struct console *, char *); | ||
59 | 35 | ||
60 | /* Prototypes for jmp fns */ | 36 | #define BUFMAX 2048 |
61 | #define _JBLEN 9 | ||
62 | typedef int jmp_buf[_JBLEN]; | ||
63 | extern void longjmp(jmp_buf __jmpb, int __retval); | ||
64 | extern int setjmp(jmp_buf __jmpb); | ||
65 | 37 | ||
66 | /* Forced breakpoint */ | 38 | #define CACHE_FLUSH_IS_SAFE 1 |
67 | #define breakpoint() __asm__ __volatile__("trapa #0x3c") | 39 | #define BREAK_INSTR_SIZE 2 |
68 | 40 | ||
69 | #endif | 41 | #endif /* __ASM_SH_KGDB_H */ |