Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
0004  */
0005 #ifndef _ASM_POWERPC_DEBUG_H
0006 #define _ASM_POWERPC_DEBUG_H
0007 
0008 #include <asm/hw_breakpoint.h>
0009 
0010 struct pt_regs;
0011 
0012 #if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC_CORE)
0013 
0014 extern int (*__debugger)(struct pt_regs *regs);
0015 extern int (*__debugger_ipi)(struct pt_regs *regs);
0016 extern int (*__debugger_bpt)(struct pt_regs *regs);
0017 extern int (*__debugger_sstep)(struct pt_regs *regs);
0018 extern int (*__debugger_iabr_match)(struct pt_regs *regs);
0019 extern int (*__debugger_break_match)(struct pt_regs *regs);
0020 extern int (*__debugger_fault_handler)(struct pt_regs *regs);
0021 
0022 #define DEBUGGER_BOILERPLATE(__NAME) \
0023 static inline int __NAME(struct pt_regs *regs) \
0024 { \
0025     if (unlikely(__ ## __NAME)) \
0026         return __ ## __NAME(regs); \
0027     return 0; \
0028 }
0029 
0030 DEBUGGER_BOILERPLATE(debugger)
0031 DEBUGGER_BOILERPLATE(debugger_ipi)
0032 DEBUGGER_BOILERPLATE(debugger_bpt)
0033 DEBUGGER_BOILERPLATE(debugger_sstep)
0034 DEBUGGER_BOILERPLATE(debugger_iabr_match)
0035 DEBUGGER_BOILERPLATE(debugger_break_match)
0036 DEBUGGER_BOILERPLATE(debugger_fault_handler)
0037 
0038 #else
0039 static inline int debugger(struct pt_regs *regs) { return 0; }
0040 static inline int debugger_ipi(struct pt_regs *regs) { return 0; }
0041 static inline int debugger_bpt(struct pt_regs *regs) { return 0; }
0042 static inline int debugger_sstep(struct pt_regs *regs) { return 0; }
0043 static inline int debugger_iabr_match(struct pt_regs *regs) { return 0; }
0044 static inline int debugger_break_match(struct pt_regs *regs) { return 0; }
0045 static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; }
0046 #endif
0047 
0048 void __set_breakpoint(int nr, struct arch_hw_breakpoint *brk);
0049 bool ppc_breakpoint_available(void);
0050 #ifdef CONFIG_PPC_ADV_DEBUG_REGS
0051 extern void do_send_trap(struct pt_regs *regs, unsigned long address,
0052              unsigned long error_code, int brkpt);
0053 #endif
0054 
0055 #endif /* _ASM_POWERPC_DEBUG_H */