kgdb.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * AArch64 KGDB support
  3. *
  4. * Based on arch/arm/include/kgdb.h
  5. *
  6. * Copyright (C) 2013 Cavium Inc.
  7. * Author: Vijaya Kumar K <vijaya.kumar@caviumnetworks.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. #ifndef __ARM_KGDB_H
  22. #define __ARM_KGDB_H
  23. #include <linux/ptrace.h>
  24. #include <asm/debug-monitors.h>
  25. #ifndef __ASSEMBLY__
  26. static inline void arch_kgdb_breakpoint(void)
  27. {
  28. asm ("brk %0" : : "I" (KGDB_COMPILED_DBG_BRK_IMM));
  29. }
  30. extern void kgdb_handle_bus_error(void);
  31. extern int kgdb_fault_expected;
  32. #endif /* !__ASSEMBLY__ */
  33. /*
  34. * gdb is expecting the following registers layout.
  35. *
  36. * General purpose regs:
  37. * r0-r30: 64 bit
  38. * sp,pc : 64 bit
  39. * pstate : 64 bit
  40. * Total: 34
  41. * FPU regs:
  42. * f0-f31: 128 bit
  43. * Total: 32
  44. * Extra regs
  45. * fpsr & fpcr: 32 bit
  46. * Total: 2
  47. *
  48. */
  49. #define _GP_REGS 34
  50. #define _FP_REGS 32
  51. #define _EXTRA_REGS 2
  52. /*
  53. * general purpose registers size in bytes.
  54. * pstate is only 4 bytes. subtract 4 bytes
  55. */
  56. #define GP_REG_BYTES (_GP_REGS * 8)
  57. #define DBG_MAX_REG_NUM (_GP_REGS + _FP_REGS + _EXTRA_REGS)
  58. /*
  59. * Size of I/O buffer for gdb packet.
  60. * considering to hold all register contents, size is set
  61. */
  62. #define BUFMAX 2048
  63. /*
  64. * Number of bytes required for gdb_regs buffer.
  65. * _GP_REGS: 8 bytes, _FP_REGS: 16 bytes and _EXTRA_REGS: 4 bytes each
  66. * GDB fails to connect for size beyond this with error
  67. * "'g' packet reply is too long"
  68. */
  69. #define NUMREGBYTES ((_GP_REGS * 8) + (_FP_REGS * 16) + \
  70. (_EXTRA_REGS * 4))
  71. #endif /* __ASM_KGDB_H */