aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-sh/kgdb.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 15:17:40 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 15:17:40 -0400
commit5b6b54982258c330247957a8d877b9851ac69d53 (patch)
tree567e4b3391e0c6689cf511789fb512ef7385c16f /include/asm-sh/kgdb.h
parent35c74823cb382c610be908f1b92f980b84e7c37c (diff)
parent39374aadcd0159b4744ab456f4efa100bea84bd4 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6: (38 commits) sh: R7785RP board updates. sh: Update r7780rp defconfig. sh: Add die chain notifiers. sh: Fix APM emulation on hp6xx. sh: Wire up more IRQs for SH7709. sh: Solution Engine 7722 board support. sh: Fix r7780rp build. sh: kdump support. sh: Move clock reporting to its own proc entry. sh: Solution Engine SH7705 board and CPU updates. serial: sh-sci: Fix module clock refcount for serial console. serial: sh-sci: Fix module clock refcounting. sh: SH7722 clock framework support. sh: hp6xx pata_platform support. sh: Obey CONFIG_HZ for HZ definition. sh: Fix fstatat64() syscall. sh: se7780 PCI support. sh: SH7780 Solution Engine board support. sh: Add a dummy SH-4 PCIC fixup. sh: Tidy up L-BOX area5 addresses. ...
Diffstat (limited to 'include/asm-sh/kgdb.h')
-rw-r--r--include/asm-sh/kgdb.h51
1 files changed, 4 insertions, 47 deletions
diff --git a/include/asm-sh/kgdb.h b/include/asm-sh/kgdb.h
index 0095c665d272..74bd0953e5ce 100644
--- a/include/asm-sh/kgdb.h
+++ b/include/asm-sh/kgdb.h
@@ -17,6 +17,7 @@
17#define __KGDB_H 17#define __KGDB_H
18 18
19#include <asm/ptrace.h> 19#include <asm/ptrace.h>
20#include <asm/cacheflush.h>
20 21
21struct console; 22struct console;
22 23
@@ -45,35 +46,21 @@ extern int kgdb_portnum;
45extern int kgdb_baud; 46extern int kgdb_baud;
46extern char kgdb_parity; 47extern char kgdb_parity;
47extern char kgdb_bits; 48extern char kgdb_bits;
48extern int kgdb_console_setup(struct console *, char *);
49 49
50/* Init and interface stuff */ 50/* Init and interface stuff */
51extern int kgdb_init(void); 51extern int kgdb_init(void);
52extern int (*kgdb_serial_setup)(void);
53extern int (*kgdb_getchar)(void); 52extern int (*kgdb_getchar)(void);
54extern void (*kgdb_putchar)(int); 53extern void (*kgdb_putchar)(int);
55 54
56struct kgdb_sermap {
57 char *name;
58 int namelen;
59 int (*setup_fn)(struct console *, char *);
60 struct kgdb_sermap *next;
61};
62extern void kgdb_register_sermap(struct kgdb_sermap *map);
63extern struct kgdb_sermap *kgdb_porttype;
64
65/* Trap functions */ 55/* Trap functions */
66typedef void (kgdb_debug_hook_t)(struct pt_regs *regs); 56typedef void (kgdb_debug_hook_t)(struct pt_regs *regs);
67typedef void (kgdb_bus_error_hook_t)(void); 57typedef void (kgdb_bus_error_hook_t)(void);
68extern kgdb_debug_hook_t *kgdb_debug_hook; 58extern kgdb_debug_hook_t *kgdb_debug_hook;
69extern kgdb_bus_error_hook_t *kgdb_bus_err_hook; 59extern kgdb_bus_error_hook_t *kgdb_bus_err_hook;
70 60
71extern void breakpoint(void);
72
73/* Console */ 61/* Console */
74struct console;
75void kgdb_console_write(struct console *co, const char *s, unsigned count); 62void kgdb_console_write(struct console *co, const char *s, unsigned count);
76void kgdb_console_init(void); 63extern int kgdb_console_setup(struct console *, char *);
77 64
78/* Prototypes for jmp fns */ 65/* Prototypes for jmp fns */
79#define _JBLEN 9 66#define _JBLEN 9
@@ -81,11 +68,8 @@ typedef int jmp_buf[_JBLEN];
81extern void longjmp(jmp_buf __jmpb, int __retval); 68extern void longjmp(jmp_buf __jmpb, int __retval);
82extern int setjmp(jmp_buf __jmpb); 69extern int setjmp(jmp_buf __jmpb);
83 70
84/* Variadic macro to print our own message to the console */
85#define KGDB_PRINTK(...) printk("KGDB: " __VA_ARGS__)
86
87/* Forced breakpoint */ 71/* Forced breakpoint */
88#define BREAKPOINT() \ 72#define breakpoint() \
89do { \ 73do { \
90 if (kgdb_enabled) \ 74 if (kgdb_enabled) \
91 __asm__ __volatile__("trapa #0x3c"); \ 75 __asm__ __volatile__("trapa #0x3c"); \
@@ -95,7 +79,6 @@ do { \
95#if defined(CONFIG_CPU_SH4) 79#if defined(CONFIG_CPU_SH4)
96#define kgdb_flush_icache_range(start, end) \ 80#define kgdb_flush_icache_range(start, end) \
97{ \ 81{ \
98 extern void __flush_purge_region(void *, int); \
99 __flush_purge_region((void*)(start), (int)(end) - (int)(start));\ 82 __flush_purge_region((void*)(start), (int)(end) - (int)(start));\
100 flush_icache_range((start), (end)); \ 83 flush_icache_range((start), (end)); \
101} 84}
@@ -103,31 +86,6 @@ do { \
103#define kgdb_flush_icache_range(start, end) do { } while (0) 86#define kgdb_flush_icache_range(start, end) do { } while (0)
104#endif 87#endif
105 88
106/* Kernel assert macros */
107#ifdef CONFIG_KGDB_KERNEL_ASSERTS
108
109/* Predefined conditions */
110#define KA_VALID_ERRNO(errno) ((errno) > 0 && (errno) <= EMEDIUMTYPE)
111#define KA_VALID_PTR_ERR(ptr) KA_VALID_ERRNO(-PTR_ERR(ptr))
112#define KA_VALID_KPTR(ptr) (!(ptr) || \
113 ((void *)(ptr) >= (void *)PAGE_OFFSET && \
114 (void *)(ptr) < ERR_PTR(-EMEDIUMTYPE)))
115#define KA_VALID_PTRORERR(errptr) \
116 (KA_VALID_KPTR(errptr) || KA_VALID_PTR_ERR(errptr))
117#define KA_HELD_GKL() (current->lock_depth >= 0)
118
119/* The actual assert */
120#define KGDB_ASSERT(condition, message) do { \
121 if (!(condition) && (kgdb_enabled)) { \
122 KGDB_PRINTK("Assertion failed at %s:%d: %s\n", \
123 __FILE__, __LINE__, message);\
124 BREAKPOINT(); \
125 } \
126} while (0)
127#else
128#define KGDB_ASSERT(condition, message)
129#endif
130
131/* Taken from sh-stub.c of GDB 4.18 */ 89/* Taken from sh-stub.c of GDB 4.18 */
132static const char hexchars[] = "0123456789abcdef"; 90static const char hexchars[] = "0123456789abcdef";
133 91
@@ -142,5 +100,4 @@ static inline char lowhex(const int x)
142{ 100{
143 return hexchars[x & 0xf]; 101 return hexchars[x & 0xf];
144} 102}
145
146#endif 103#endif