gdb-stub.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /* gdb-stub.h: FRV GDB stub
  2. *
  3. * Copyright (C) 2003 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
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version
  10. * 2 of the License, or (at your option) any later version.
  11. */
  12. #ifndef __ASM_GDB_STUB_H
  13. #define __ASM_GDB_STUB_H
  14. #undef GDBSTUB_DEBUG_IO
  15. #undef GDBSTUB_DEBUG_PROTOCOL
  16. #include <asm/ptrace.h>
  17. /*
  18. * important register numbers in GDB protocol
  19. * - GR0, GR1, GR2, GR3, GR4, GR5, GR6, GR7,
  20. * - GR8, GR9, GR10, GR11, GR12, GR13, GR14, GR15,
  21. * - GR16, GR17, GR18, GR19, GR20, GR21, GR22, GR23,
  22. * - GR24, GR25, GR26, GR27, GR28, GR29, GR30, GR31,
  23. * - GR32, GR33, GR34, GR35, GR36, GR37, GR38, GR39,
  24. * - GR40, GR41, GR42, GR43, GR44, GR45, GR46, GR47,
  25. * - GR48, GR49, GR50, GR51, GR52, GR53, GR54, GR55,
  26. * - GR56, GR57, GR58, GR59, GR60, GR61, GR62, GR63,
  27. * - FR0, FR1, FR2, FR3, FR4, FR5, FR6, FR7,
  28. * - FR8, FR9, FR10, FR11, FR12, FR13, FR14, FR15,
  29. * - FR16, FR17, FR18, FR19, FR20, FR21, FR22, FR23,
  30. * - FR24, FR25, FR26, FR27, FR28, FR29, FR30, FR31,
  31. * - FR32, FR33, FR34, FR35, FR36, FR37, FR38, FR39,
  32. * - FR40, FR41, FR42, FR43, FR44, FR45, FR46, FR47,
  33. * - FR48, FR49, FR50, FR51, FR52, FR53, FR54, FR55,
  34. * - FR56, FR57, FR58, FR59, FR60, FR61, FR62, FR63,
  35. * - PC, PSR, CCR, CCCR,
  36. * - _X132, _X133, _X134
  37. * - TBR, BRR, DBAR0, DBAR1, DBAR2, DBAR3,
  38. * - SCR0, SCR1, SCR2, SCR3,
  39. * - LR, LCR,
  40. * - IACC0H, IACC0L,
  41. * - FSR0,
  42. * - ACC0, ACC1, ACC2, ACC3, ACC4, ACC5, ACC6, ACC7,
  43. * - ACCG0123, ACCG4567,
  44. * - MSR0, MSR1,
  45. * - GNER0, GNER1,
  46. * - FNER0, FNER1,
  47. */
  48. #define GDB_REG_GR(N) (N)
  49. #define GDB_REG_FR(N) (64+(N))
  50. #define GDB_REG_PC 128
  51. #define GDB_REG_PSR 129
  52. #define GDB_REG_CCR 130
  53. #define GDB_REG_CCCR 131
  54. #define GDB_REG_TBR 135
  55. #define GDB_REG_BRR 136
  56. #define GDB_REG_DBAR(N) (137+(N))
  57. #define GDB_REG_SCR(N) (141+(N))
  58. #define GDB_REG_LR 145
  59. #define GDB_REG_LCR 146
  60. #define GDB_REG_FSR0 149
  61. #define GDB_REG_ACC(N) (150+(N))
  62. #define GDB_REG_ACCG(N) (158+(N)/4)
  63. #define GDB_REG_MSR(N) (160+(N))
  64. #define GDB_REG_GNER(N) (162+(N))
  65. #define GDB_REG_FNER(N) (164+(N))
  66. #define GDB_REG_SP GDB_REG_GR(1)
  67. #define GDB_REG_FP GDB_REG_GR(2)
  68. #ifndef _LANGUAGE_ASSEMBLY
  69. /*
  70. * Prototypes
  71. */
  72. extern void show_registers_only(struct pt_regs *regs);
  73. extern void gdbstub_init(void);
  74. extern void gdbstub(int type);
  75. extern void gdbstub_exit(int status);
  76. extern void gdbstub_io_init(void);
  77. extern void gdbstub_set_baud(unsigned baud);
  78. extern int gdbstub_rx_char(unsigned char *_ch, int nonblock);
  79. extern void gdbstub_tx_char(unsigned char ch);
  80. extern void gdbstub_tx_flush(void);
  81. extern void gdbstub_do_rx(void);
  82. extern asmlinkage void __debug_stub_init_break(void);
  83. extern asmlinkage void __break_hijack_kernel_event(void);
  84. extern asmlinkage void __break_hijack_kernel_event_breaks_here(void);
  85. extern asmlinkage void gdbstub_rx_handler(void);
  86. extern asmlinkage void gdbstub_rx_irq(void);
  87. extern asmlinkage void gdbstub_intercept(void);
  88. extern uint32_t __entry_usertrap_table[];
  89. extern uint32_t __entry_kerneltrap_table[];
  90. extern volatile u8 gdbstub_rx_buffer[PAGE_SIZE];
  91. extern volatile u32 gdbstub_rx_inp;
  92. extern volatile u32 gdbstub_rx_outp;
  93. extern volatile u8 gdbstub_rx_overflow;
  94. extern u8 gdbstub_rx_unget;
  95. extern void gdbstub_printk(const char *fmt, ...);
  96. extern void debug_to_serial(const char *p, int n);
  97. extern void console_set_baud(unsigned baud);
  98. #ifdef GDBSTUB_DEBUG_IO
  99. #define gdbstub_io(FMT,...) gdbstub_printk(FMT, ##__VA_ARGS__)
  100. #else
  101. #define gdbstub_io(FMT,...) ({ 0; })
  102. #endif
  103. #ifdef GDBSTUB_DEBUG_PROTOCOL
  104. #define gdbstub_proto(FMT,...) gdbstub_printk(FMT,##__VA_ARGS__)
  105. #else
  106. #define gdbstub_proto(FMT,...) ({ 0; })
  107. #endif
  108. /*
  109. * we dedicate GR31 to keeping a pointer to the gdbstub exception frame
  110. * - gr31 is destroyed on entry to the gdbstub if !MMU
  111. * - gr31 is saved in scr3 on entry to the gdbstub if in !MMU
  112. */
  113. register struct frv_frame0 *__debug_frame0 asm("gr31");
  114. #define __debug_frame (&__debug_frame0->regs)
  115. #define __debug_user_context (&__debug_frame0->uc)
  116. #define __debug_regs (&__debug_frame0->debug)
  117. #define __debug_reg(X) ((unsigned long *) ((unsigned long) &__debug_frame0 + (X)))
  118. struct frv_debug_status {
  119. unsigned long bpsr;
  120. unsigned long dcr;
  121. unsigned long brr;
  122. unsigned long nmar;
  123. };
  124. extern struct frv_debug_status __debug_status;
  125. #endif /* _LANGUAGE_ASSEMBLY */
  126. #endif /* __ASM_GDB_STUB_H */