blob: 5d5af3fddfd881ee5b54df7eae5edaffc1b1305e [file] [log] [blame]
David Howellsae3a1972012-03-28 18:30:02 +01001/*
2 * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
3 */
4#ifndef _ASM_POWERPC_DEBUG_H
5#define _ASM_POWERPC_DEBUG_H
6
Michael Neuling9422de32012-12-20 14:06:44 +00007#include <asm/hw_breakpoint.h>
8
David Howellsae3a1972012-03-28 18:30:02 +01009struct pt_regs;
10
Thiago Jung Bauermannda665882016-11-29 23:45:50 +110011#if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC_CORE)
David Howellsae3a1972012-03-28 18:30:02 +010012
13extern int (*__debugger)(struct pt_regs *regs);
14extern int (*__debugger_ipi)(struct pt_regs *regs);
15extern int (*__debugger_bpt)(struct pt_regs *regs);
16extern int (*__debugger_sstep)(struct pt_regs *regs);
17extern int (*__debugger_iabr_match)(struct pt_regs *regs);
Michael Neuling9422de32012-12-20 14:06:44 +000018extern int (*__debugger_break_match)(struct pt_regs *regs);
David Howellsae3a1972012-03-28 18:30:02 +010019extern int (*__debugger_fault_handler)(struct pt_regs *regs);
20
21#define DEBUGGER_BOILERPLATE(__NAME) \
22static inline int __NAME(struct pt_regs *regs) \
23{ \
24 if (unlikely(__ ## __NAME)) \
25 return __ ## __NAME(regs); \
26 return 0; \
27}
28
29DEBUGGER_BOILERPLATE(debugger)
30DEBUGGER_BOILERPLATE(debugger_ipi)
31DEBUGGER_BOILERPLATE(debugger_bpt)
32DEBUGGER_BOILERPLATE(debugger_sstep)
33DEBUGGER_BOILERPLATE(debugger_iabr_match)
Michael Neuling9422de32012-12-20 14:06:44 +000034DEBUGGER_BOILERPLATE(debugger_break_match)
David Howellsae3a1972012-03-28 18:30:02 +010035DEBUGGER_BOILERPLATE(debugger_fault_handler)
36
37#else
38static inline int debugger(struct pt_regs *regs) { return 0; }
39static inline int debugger_ipi(struct pt_regs *regs) { return 0; }
40static inline int debugger_bpt(struct pt_regs *regs) { return 0; }
41static inline int debugger_sstep(struct pt_regs *regs) { return 0; }
42static inline int debugger_iabr_match(struct pt_regs *regs) { return 0; }
Michael Neuling9422de32012-12-20 14:06:44 +000043static inline int debugger_break_match(struct pt_regs *regs) { return 0; }
David Howellsae3a1972012-03-28 18:30:02 +010044static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; }
45#endif
46
Paul Gortmaker04c32a52014-04-29 15:25:16 -040047void set_breakpoint(struct arch_hw_breakpoint *brk);
Paul Gortmaker21f58502014-04-29 15:25:17 -040048void __set_breakpoint(struct arch_hw_breakpoint *brk);
David Howellsae3a1972012-03-28 18:30:02 +010049#ifdef CONFIG_PPC_ADV_DEBUG_REGS
50extern void do_send_trap(struct pt_regs *regs, unsigned long address,
51 unsigned long error_code, int signal_code, int brkpt);
52#else
Michael Neuling9422de32012-12-20 14:06:44 +000053
54extern void do_break(struct pt_regs *regs, unsigned long address,
55 unsigned long error_code);
David Howellsae3a1972012-03-28 18:30:02 +010056#endif
57
58#endif /* _ASM_POWERPC_DEBUG_H */