1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2ae3a197eSDavid Howells /* 3ae3a197eSDavid Howells * Copyright (C) 1999 Cort Dougan <[email protected]> 4ae3a197eSDavid Howells */ 5ae3a197eSDavid Howells #ifndef _ASM_POWERPC_DEBUG_H 6ae3a197eSDavid Howells #define _ASM_POWERPC_DEBUG_H 7ae3a197eSDavid Howells 89422de3eSMichael Neuling #include <asm/hw_breakpoint.h> 99422de3eSMichael Neuling 10ae3a197eSDavid Howells struct pt_regs; 11ae3a197eSDavid Howells 12da665885SThiago Jung Bauermann #if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC_CORE) 13ae3a197eSDavid Howells 14ae3a197eSDavid Howells extern int (*__debugger)(struct pt_regs *regs); 15ae3a197eSDavid Howells extern int (*__debugger_ipi)(struct pt_regs *regs); 16ae3a197eSDavid Howells extern int (*__debugger_bpt)(struct pt_regs *regs); 17ae3a197eSDavid Howells extern int (*__debugger_sstep)(struct pt_regs *regs); 18ae3a197eSDavid Howells extern int (*__debugger_iabr_match)(struct pt_regs *regs); 199422de3eSMichael Neuling extern int (*__debugger_break_match)(struct pt_regs *regs); 20ae3a197eSDavid Howells extern int (*__debugger_fault_handler)(struct pt_regs *regs); 21ae3a197eSDavid Howells 22ae3a197eSDavid Howells #define DEBUGGER_BOILERPLATE(__NAME) \ 23ae3a197eSDavid Howells static inline int __NAME(struct pt_regs *regs) \ 24ae3a197eSDavid Howells { \ 25ae3a197eSDavid Howells if (unlikely(__ ## __NAME)) \ 26ae3a197eSDavid Howells return __ ## __NAME(regs); \ 27ae3a197eSDavid Howells return 0; \ 28ae3a197eSDavid Howells } 29ae3a197eSDavid Howells 30ae3a197eSDavid Howells DEBUGGER_BOILERPLATE(debugger) 31ae3a197eSDavid Howells DEBUGGER_BOILERPLATE(debugger_ipi) 32ae3a197eSDavid Howells DEBUGGER_BOILERPLATE(debugger_bpt) 33ae3a197eSDavid Howells DEBUGGER_BOILERPLATE(debugger_sstep) 34ae3a197eSDavid Howells DEBUGGER_BOILERPLATE(debugger_iabr_match) 359422de3eSMichael Neuling DEBUGGER_BOILERPLATE(debugger_break_match) 36ae3a197eSDavid Howells DEBUGGER_BOILERPLATE(debugger_fault_handler) 37ae3a197eSDavid Howells 38ae3a197eSDavid Howells #else 39ae3a197eSDavid Howells static inline int debugger(struct pt_regs *regs) { return 0; } 40ae3a197eSDavid Howells static inline int debugger_ipi(struct pt_regs *regs) { return 0; } 41ae3a197eSDavid Howells static inline int debugger_bpt(struct pt_regs *regs) { return 0; } 42ae3a197eSDavid Howells static inline int debugger_sstep(struct pt_regs *regs) { return 0; } 43ae3a197eSDavid Howells static inline int debugger_iabr_match(struct pt_regs *regs) { return 0; } 449422de3eSMichael Neuling static inline int debugger_break_match(struct pt_regs *regs) { return 0; } 45ae3a197eSDavid Howells static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; } 46ae3a197eSDavid Howells #endif 47ae3a197eSDavid Howells 484a8a9379SRavi Bangoria void __set_breakpoint(int nr, struct arch_hw_breakpoint *brk); 49*3671f4ebSJordan Niethe void suspend_breakpoints(void); 50*3671f4ebSJordan Niethe void restore_breakpoints(void); 51404b27d6SMichael Neuling bool ppc_breakpoint_available(void); 52ae3a197eSDavid Howells #ifdef CONFIG_PPC_ADV_DEBUG_REGS 53ae3a197eSDavid Howells extern void do_send_trap(struct pt_regs *regs, unsigned long address, 5447355040SEric W. Biederman unsigned long error_code, int brkpt); 55ae3a197eSDavid Howells #endif 56ae3a197eSDavid Howells 57ae3a197eSDavid Howells #endif /* _ASM_POWERPC_DEBUG_H */ 58