debug.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
  3. */
  4. #ifndef _ASM_POWERPC_DEBUG_H
  5. #define _ASM_POWERPC_DEBUG_H
  6. struct pt_regs;
  7. extern struct dentry *powerpc_debugfs_root;
  8. #if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
  9. extern int (*__debugger)(struct pt_regs *regs);
  10. extern int (*__debugger_ipi)(struct pt_regs *regs);
  11. extern int (*__debugger_bpt)(struct pt_regs *regs);
  12. extern int (*__debugger_sstep)(struct pt_regs *regs);
  13. extern int (*__debugger_iabr_match)(struct pt_regs *regs);
  14. extern int (*__debugger_dabr_match)(struct pt_regs *regs);
  15. extern int (*__debugger_fault_handler)(struct pt_regs *regs);
  16. #define DEBUGGER_BOILERPLATE(__NAME) \
  17. static inline int __NAME(struct pt_regs *regs) \
  18. { \
  19. if (unlikely(__ ## __NAME)) \
  20. return __ ## __NAME(regs); \
  21. return 0; \
  22. }
  23. DEBUGGER_BOILERPLATE(debugger)
  24. DEBUGGER_BOILERPLATE(debugger_ipi)
  25. DEBUGGER_BOILERPLATE(debugger_bpt)
  26. DEBUGGER_BOILERPLATE(debugger_sstep)
  27. DEBUGGER_BOILERPLATE(debugger_iabr_match)
  28. DEBUGGER_BOILERPLATE(debugger_dabr_match)
  29. DEBUGGER_BOILERPLATE(debugger_fault_handler)
  30. #else
  31. static inline int debugger(struct pt_regs *regs) { return 0; }
  32. static inline int debugger_ipi(struct pt_regs *regs) { return 0; }
  33. static inline int debugger_bpt(struct pt_regs *regs) { return 0; }
  34. static inline int debugger_sstep(struct pt_regs *regs) { return 0; }
  35. static inline int debugger_iabr_match(struct pt_regs *regs) { return 0; }
  36. static inline int debugger_dabr_match(struct pt_regs *regs) { return 0; }
  37. static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; }
  38. #endif
  39. extern int set_dabr(unsigned long dabr);
  40. #ifdef CONFIG_PPC_ADV_DEBUG_REGS
  41. extern void do_send_trap(struct pt_regs *regs, unsigned long address,
  42. unsigned long error_code, int signal_code, int brkpt);
  43. #else
  44. extern void do_dabr(struct pt_regs *regs, unsigned long address,
  45. unsigned long error_code);
  46. #endif
  47. #endif /* _ASM_POWERPC_DEBUG_H */