kgdb.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * May be copied or modified under the terms of the GNU General Public
  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. #ifndef __KGDB_H
  16. #define __KGDB_H
  17. #include <asm/ptrace.h>
  18. /* Same as pt_regs but has vbr in place of syscall_nr */
  19. struct kgdb_regs {
  20. unsigned long regs[16];
  21. unsigned long pc;
  22. unsigned long pr;
  23. unsigned long sr;
  24. unsigned long gbr;
  25. unsigned long mach;
  26. unsigned long macl;
  27. unsigned long vbr;
  28. };
  29. /* State info */
  30. extern char kgdb_in_gdb_mode;
  31. extern int kgdb_nofault; /* Ignore bus errors (in gdb mem access) */
  32. extern char in_nmi; /* Debounce flag to prevent NMI reentry*/
  33. /* SCI */
  34. extern int kgdb_portnum;
  35. extern int kgdb_baud;
  36. extern char kgdb_parity;
  37. extern char kgdb_bits;
  38. /* Init and interface stuff */
  39. extern int kgdb_init(void);
  40. extern int (*kgdb_getchar)(void);
  41. extern void (*kgdb_putchar)(int);
  42. /* Trap functions */
  43. typedef void (kgdb_debug_hook_t)(struct pt_regs *regs);
  44. typedef void (kgdb_bus_error_hook_t)(void);
  45. extern kgdb_debug_hook_t *kgdb_debug_hook;
  46. extern kgdb_bus_error_hook_t *kgdb_bus_err_hook;
  47. /* Console */
  48. struct console;
  49. void kgdb_console_write(struct console *co, const char *s, unsigned count);
  50. extern int kgdb_console_setup(struct console *, char *);
  51. /* Prototypes for jmp fns */
  52. #define _JBLEN 9
  53. typedef int jmp_buf[_JBLEN];
  54. extern void longjmp(jmp_buf __jmpb, int __retval);
  55. extern int setjmp(jmp_buf __jmpb);
  56. /* Forced breakpoint */
  57. #define breakpoint() __asm__ __volatile__("trapa #0x3c")
  58. /* Taken from sh-stub.c of GDB 4.18 */
  59. static const char hexchars[] = "0123456789abcdef";
  60. /* Get high hex bits */
  61. static inline char highhex(const int x)
  62. {
  63. return hexchars[(x >> 4) & 0xf];
  64. }
  65. /* Get low hex bits */
  66. static inline char lowhex(const int x)
  67. {
  68. return hexchars[x & 0xf];
  69. }
  70. #endif