debug.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 1999 Cort Dougan <[email protected]>
  4. */
  5. #ifndef _ASM_POWERPC_DEBUG_H
  6. #define _ASM_POWERPC_DEBUG_H
  7. #include <asm/hw_breakpoint.h>
  8. struct pt_regs;
  9. #if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC_CORE)
  10. extern int (*__debugger)(struct pt_regs *regs);
  11. extern int (*__debugger_ipi)(struct pt_regs *regs);
  12. extern int (*__debugger_bpt)(struct pt_regs *regs);
  13. extern int (*__debugger_sstep)(struct pt_regs *regs);
  14. extern int (*__debugger_iabr_match)(struct pt_regs *regs);
  15. extern int (*__debugger_break_match)(struct pt_regs *regs);
  16. extern int (*__debugger_fault_handler)(struct pt_regs *regs);
  17. #define DEBUGGER_BOILERPLATE(__NAME) \
  18. static inline int __NAME(struct pt_regs *regs) \
  19. { \
  20. if (unlikely(__ ## __NAME)) \
  21. return __ ## __NAME(regs); \
  22. return 0; \
  23. }
  24. DEBUGGER_BOILERPLATE(debugger)
  25. DEBUGGER_BOILERPLATE(debugger_ipi)
  26. DEBUGGER_BOILERPLATE(debugger_bpt)
  27. DEBUGGER_BOILERPLATE(debugger_sstep)
  28. DEBUGGER_BOILERPLATE(debugger_iabr_match)
  29. DEBUGGER_BOILERPLATE(debugger_break_match)
  30. DEBUGGER_BOILERPLATE(debugger_fault_handler)
  31. #else
  32. static inline int debugger(struct pt_regs *regs) { return 0; }
  33. static inline int debugger_ipi(struct pt_regs *regs) { return 0; }
  34. static inline int debugger_bpt(struct pt_regs *regs) { return 0; }
  35. static inline int debugger_sstep(struct pt_regs *regs) { return 0; }
  36. static inline int debugger_iabr_match(struct pt_regs *regs) { return 0; }
  37. static inline int debugger_break_match(struct pt_regs *regs) { return 0; }
  38. static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; }
  39. #endif
  40. void __set_breakpoint(int nr, struct arch_hw_breakpoint *brk);
  41. bool ppc_breakpoint_available(void);
  42. #ifdef CONFIG_PPC_ADV_DEBUG_REGS
  43. extern void do_send_trap(struct pt_regs *regs, unsigned long address,
  44. unsigned long error_code, int brkpt);
  45. #endif
  46. #endif /* _ASM_POWERPC_DEBUG_H */