2005-04-16 16:20:36 -06:00
|
|
|
/*
|
|
|
|
* May be copied or modified under the terms of the GNU General Public
|
|
|
|
* License. See linux/COPYING for more information.
|
|
|
|
*
|
|
|
|
* Based on original code by Glenn Engel, Jim Kingdon,
|
|
|
|
* David Grothe <dave@gcom.com>, Tigran Aivazian, <tigran@sco.com> and
|
|
|
|
* Amit S. Kale <akale@veritas.com>
|
|
|
|
*
|
|
|
|
* Super-H port based on sh-stub.c (Ben Lee and Steve Chamberlain) by
|
|
|
|
* Henry Bell <henry.bell@st.com>
|
|
|
|
*
|
|
|
|
* Header file for low-level support for remote debug using GDB.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __KGDB_H
|
|
|
|
#define __KGDB_H
|
|
|
|
|
|
|
|
#include <asm/ptrace.h>
|
|
|
|
|
|
|
|
/* Same as pt_regs but has vbr in place of syscall_nr */
|
|
|
|
struct kgdb_regs {
|
|
|
|
unsigned long regs[16];
|
|
|
|
unsigned long pc;
|
|
|
|
unsigned long pr;
|
|
|
|
unsigned long sr;
|
|
|
|
unsigned long gbr;
|
|
|
|
unsigned long mach;
|
|
|
|
unsigned long macl;
|
|
|
|
unsigned long vbr;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* State info */
|
|
|
|
extern char kgdb_in_gdb_mode;
|
|
|
|
extern int kgdb_nofault; /* Ignore bus errors (in gdb mem access) */
|
|
|
|
extern char in_nmi; /* Debounce flag to prevent NMI reentry*/
|
|
|
|
|
|
|
|
/* SCI */
|
|
|
|
extern int kgdb_portnum;
|
|
|
|
extern int kgdb_baud;
|
|
|
|
extern char kgdb_parity;
|
|
|
|
extern char kgdb_bits;
|
|
|
|
|
|
|
|
/* Init and interface stuff */
|
|
|
|
extern int kgdb_init(void);
|
|
|
|
extern int (*kgdb_getchar)(void);
|
|
|
|
extern void (*kgdb_putchar)(int);
|
|
|
|
|
|
|
|
/* Trap functions */
|
2007-03-08 01:27:37 -07:00
|
|
|
typedef void (kgdb_debug_hook_t)(struct pt_regs *regs);
|
2005-04-16 16:20:36 -06:00
|
|
|
typedef void (kgdb_bus_error_hook_t)(void);
|
|
|
|
extern kgdb_debug_hook_t *kgdb_debug_hook;
|
|
|
|
extern kgdb_bus_error_hook_t *kgdb_bus_err_hook;
|
|
|
|
|
|
|
|
/* Console */
|
2007-10-03 02:13:34 -06:00
|
|
|
struct console;
|
2005-04-16 16:20:36 -06:00
|
|
|
void kgdb_console_write(struct console *co, const char *s, unsigned count);
|
2007-03-08 01:27:37 -07:00
|
|
|
extern int kgdb_console_setup(struct console *, char *);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
/* Prototypes for jmp fns */
|
|
|
|
#define _JBLEN 9
|
|
|
|
typedef int jmp_buf[_JBLEN];
|
|
|
|
extern void longjmp(jmp_buf __jmpb, int __retval);
|
|
|
|
extern int setjmp(jmp_buf __jmpb);
|
|
|
|
|
|
|
|
/* Forced breakpoint */
|
2007-10-03 02:13:34 -06:00
|
|
|
#define breakpoint() __asm__ __volatile__("trapa #0x3c")
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2006-09-27 01:24:55 -06:00
|
|
|
/* Taken from sh-stub.c of GDB 4.18 */
|
|
|
|
static const char hexchars[] = "0123456789abcdef";
|
|
|
|
|
|
|
|
/* Get high hex bits */
|
|
|
|
static inline char highhex(const int x)
|
|
|
|
{
|
|
|
|
return hexchars[(x >> 4) & 0xf];
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get low hex bits */
|
|
|
|
static inline char lowhex(const int x)
|
|
|
|
{
|
|
|
|
return hexchars[x & 0xf];
|
|
|
|
}
|
2005-04-16 16:20:36 -06:00
|
|
|
#endif
|