Linux 2.6.26.3
[linux/fpc-iii.git] / include / asm-mn10300 / gdb-stub.h
blobe5a6368559af900722d896049bd4a60e0a1db2fa
1 /* MN10300 Kernel GDB stub definitions
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 * - Derived from asm-mips/gdb-stub.h (c) 1995 Andreas Busse
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public Licence
9 * as published by the Free Software Foundation; either version
10 * 2 of the Licence, or (at your option) any later version.
12 #ifndef _ASM_GDB_STUB_H
13 #define _ASM_GDB_STUB_H
15 #include <asm/exceptions.h>
18 * register ID numbers in GDB remote protocol
21 #define GDB_REGID_PC 9
22 #define GDB_REGID_FP 7
23 #define GDB_REGID_SP 8
26 * virtual stack layout for the GDB exception handler
28 #define NUMREGS 64
30 #define GDB_FR_D0 (0 * 4)
31 #define GDB_FR_D1 (1 * 4)
32 #define GDB_FR_D2 (2 * 4)
33 #define GDB_FR_D3 (3 * 4)
34 #define GDB_FR_A0 (4 * 4)
35 #define GDB_FR_A1 (5 * 4)
36 #define GDB_FR_A2 (6 * 4)
37 #define GDB_FR_A3 (7 * 4)
39 #define GDB_FR_SP (8 * 4)
40 #define GDB_FR_PC (9 * 4)
41 #define GDB_FR_MDR (10 * 4)
42 #define GDB_FR_EPSW (11 * 4)
43 #define GDB_FR_LIR (12 * 4)
44 #define GDB_FR_LAR (13 * 4)
45 #define GDB_FR_MDRQ (14 * 4)
47 #define GDB_FR_E0 (15 * 4)
48 #define GDB_FR_E1 (16 * 4)
49 #define GDB_FR_E2 (17 * 4)
50 #define GDB_FR_E3 (18 * 4)
51 #define GDB_FR_E4 (19 * 4)
52 #define GDB_FR_E5 (20 * 4)
53 #define GDB_FR_E6 (21 * 4)
54 #define GDB_FR_E7 (22 * 4)
56 #define GDB_FR_SSP (23 * 4)
57 #define GDB_FR_MSP (24 * 4)
58 #define GDB_FR_USP (25 * 4)
59 #define GDB_FR_MCRH (26 * 4)
60 #define GDB_FR_MCRL (27 * 4)
61 #define GDB_FR_MCVF (28 * 4)
63 #define GDB_FR_FPCR (29 * 4)
64 #define GDB_FR_DUMMY0 (30 * 4)
65 #define GDB_FR_DUMMY1 (31 * 4)
67 #define GDB_FR_FS0 (32 * 4)
69 #define GDB_FR_SIZE (NUMREGS * 4)
71 #ifndef __ASSEMBLY__
74 * This is the same as above, but for the high-level
75 * part of the GDB stub.
78 struct gdb_regs {
79 /* saved main processor registers */
80 u32 d0, d1, d2, d3, a0, a1, a2, a3;
81 u32 sp, pc, mdr, epsw, lir, lar, mdrq;
82 u32 e0, e1, e2, e3, e4, e5, e6, e7;
83 u32 ssp, msp, usp, mcrh, mcrl, mcvf;
85 /* saved floating point registers */
86 u32 fpcr, _dummy0, _dummy1;
87 u32 fs0, fs1, fs2, fs3, fs4, fs5, fs6, fs7;
88 u32 fs8, fs9, fs10, fs11, fs12, fs13, fs14, fs15;
89 u32 fs16, fs17, fs18, fs19, fs20, fs21, fs22, fs23;
90 u32 fs24, fs25, fs26, fs27, fs28, fs29, fs30, fs31;
94 * Prototypes
96 extern void show_registers_only(struct pt_regs *regs);
98 extern asmlinkage void gdbstub_init(void);
99 extern asmlinkage void gdbstub_exit(int status);
100 extern asmlinkage void gdbstub_io_init(void);
101 extern asmlinkage void gdbstub_io_set_baud(unsigned baud);
102 extern asmlinkage int gdbstub_io_rx_char(unsigned char *_ch, int nonblock);
103 extern asmlinkage void gdbstub_io_tx_char(unsigned char ch);
104 extern asmlinkage void gdbstub_io_tx_flush(void);
106 extern asmlinkage void gdbstub_io_rx_handler(void);
107 extern asmlinkage void gdbstub_rx_irq(struct pt_regs *, enum exception_code);
108 extern asmlinkage int gdbstub_intercept(struct pt_regs *, enum exception_code);
109 extern asmlinkage void gdbstub_exception(struct pt_regs *, enum exception_code);
110 extern asmlinkage void __gdbstub_bug_trap(void);
111 extern asmlinkage void __gdbstub_pause(void);
112 extern asmlinkage void start_kernel(void);
114 #ifndef CONFIG_MN10300_CACHE_DISABLED
115 extern asmlinkage void gdbstub_purge_cache(void);
116 #else
117 #define gdbstub_purge_cache() do {} while (0)
118 #endif
120 /* Used to prevent crashes in memory access */
121 extern asmlinkage int gdbstub_read_byte(const u8 *, u8 *);
122 extern asmlinkage int gdbstub_read_word(const u8 *, u8 *);
123 extern asmlinkage int gdbstub_read_dword(const u8 *, u8 *);
124 extern asmlinkage int gdbstub_write_byte(u32, u8 *);
125 extern asmlinkage int gdbstub_write_word(u32, u8 *);
126 extern asmlinkage int gdbstub_write_dword(u32, u8 *);
128 extern asmlinkage void gdbstub_read_byte_guard(void);
129 extern asmlinkage void gdbstub_read_byte_cont(void);
130 extern asmlinkage void gdbstub_read_word_guard(void);
131 extern asmlinkage void gdbstub_read_word_cont(void);
132 extern asmlinkage void gdbstub_read_dword_guard(void);
133 extern asmlinkage void gdbstub_read_dword_cont(void);
134 extern asmlinkage void gdbstub_write_byte_guard(void);
135 extern asmlinkage void gdbstub_write_byte_cont(void);
136 extern asmlinkage void gdbstub_write_word_guard(void);
137 extern asmlinkage void gdbstub_write_word_cont(void);
138 extern asmlinkage void gdbstub_write_dword_guard(void);
139 extern asmlinkage void gdbstub_write_dword_cont(void);
141 extern u8 gdbstub_rx_buffer[PAGE_SIZE];
142 extern u32 gdbstub_rx_inp;
143 extern u32 gdbstub_rx_outp;
144 extern u8 gdbstub_rx_overflow;
145 extern u8 gdbstub_busy;
146 extern u8 gdbstub_rx_unget;
148 #ifdef CONFIG_GDBSTUB_DEBUGGING
149 extern void gdbstub_printk(const char *fmt, ...)
150 __attribute__((format(printf, 1, 2)));
151 #else
152 static inline __attribute__((format(printf, 1, 2)))
153 void gdbstub_printk(const char *fmt, ...)
156 #endif
158 #ifdef CONFIG_GDBSTUB_DEBUG_ENTRY
159 #define gdbstub_entry(FMT, ...) gdbstub_printk(FMT, ##__VA_ARGS__)
160 #else
161 #define gdbstub_entry(FMT, ...) ({ 0; })
162 #endif
164 #ifdef CONFIG_GDBSTUB_DEBUG_PROTOCOL
165 #define gdbstub_proto(FMT, ...) gdbstub_printk(FMT, ##__VA_ARGS__)
166 #else
167 #define gdbstub_proto(FMT, ...) ({ 0; })
168 #endif
170 #ifdef CONFIG_GDBSTUB_DEBUG_IO
171 #define gdbstub_io(FMT, ...) gdbstub_printk(FMT, ##__VA_ARGS__)
172 #else
173 #define gdbstub_io(FMT, ...) ({ 0; })
174 #endif
176 #ifdef CONFIG_GDBSTUB_DEBUG_BREAKPOINT
177 #define gdbstub_bkpt(FMT, ...) gdbstub_printk(FMT, ##__VA_ARGS__)
178 #else
179 #define gdbstub_bkpt(FMT, ...) ({ 0; })
180 #endif
182 #endif /* !__ASSEMBLY__ */
183 #endif /* _ASM_GDB_STUB_H */