0001
0002 #ifndef _ASM_POWERPC_FTRACE
0003 #define _ASM_POWERPC_FTRACE
0004
0005 #include <asm/types.h>
0006
0007 #ifdef CONFIG_FUNCTION_TRACER
0008 #define MCOUNT_ADDR ((unsigned long)(_mcount))
0009 #define MCOUNT_INSN_SIZE 4
0010
0011 #define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
0012
0013 #ifndef __ASSEMBLY__
0014 extern void _mcount(void);
0015
0016 static inline unsigned long ftrace_call_adjust(unsigned long addr)
0017 {
0018
0019 return addr;
0020 }
0021
0022 unsigned long prepare_ftrace_return(unsigned long parent, unsigned long ip,
0023 unsigned long sp);
0024
0025 struct dyn_arch_ftrace {
0026 struct module *mod;
0027 };
0028
0029 #ifdef CONFIG_DYNAMIC_FTRACE_WITH_ARGS
0030 struct ftrace_regs {
0031 struct pt_regs regs;
0032 };
0033
0034 static __always_inline struct pt_regs *arch_ftrace_get_regs(struct ftrace_regs *fregs)
0035 {
0036
0037 return fregs->regs.msr ? &fregs->regs : NULL;
0038 }
0039
0040 static __always_inline void ftrace_instruction_pointer_set(struct ftrace_regs *fregs,
0041 unsigned long ip)
0042 {
0043 regs_set_return_ip(&fregs->regs, ip);
0044 }
0045
0046 struct ftrace_ops;
0047
0048 #define ftrace_graph_func ftrace_graph_func
0049 void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
0050 struct ftrace_ops *op, struct ftrace_regs *fregs);
0051 #endif
0052 #endif
0053
0054 #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
0055 #define ARCH_SUPPORTS_FTRACE_OPS 1
0056 #endif
0057 #endif
0058
0059 #ifndef __ASSEMBLY__
0060 #ifdef CONFIG_FTRACE_SYSCALLS
0061
0062
0063
0064
0065
0066 #define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
0067 #ifdef CONFIG_PPC64_ELF_ABI_V1
0068 static inline bool arch_syscall_match_sym_name(const char *sym, const char *name)
0069 {
0070
0071 return !strcmp(sym + 1, name) ||
0072 (!strncmp(sym, ".__se_sys", 9) && !strcmp(sym + 6, name)) ||
0073 (!strncmp(sym, ".ppc_", 5) && !strcmp(sym + 5, name + 4)) ||
0074 (!strncmp(sym, ".ppc32_", 7) && !strcmp(sym + 7, name + 4)) ||
0075 (!strncmp(sym, ".ppc64_", 7) && !strcmp(sym + 7, name + 4));
0076 }
0077 #else
0078 static inline bool arch_syscall_match_sym_name(const char *sym, const char *name)
0079 {
0080 return !strcmp(sym, name) ||
0081 (!strncmp(sym, "__se_sys", 8) && !strcmp(sym + 5, name)) ||
0082 (!strncmp(sym, "ppc_", 4) && !strcmp(sym + 4, name + 4)) ||
0083 (!strncmp(sym, "ppc32_", 6) && !strcmp(sym + 6, name + 4)) ||
0084 (!strncmp(sym, "ppc64_", 6) && !strcmp(sym + 6, name + 4));
0085 }
0086 #endif
0087 #endif
0088
0089 #if defined(CONFIG_PPC64) && defined(CONFIG_FUNCTION_TRACER)
0090 #include <asm/paca.h>
0091
0092 static inline void this_cpu_disable_ftrace(void)
0093 {
0094 get_paca()->ftrace_enabled = 0;
0095 }
0096
0097 static inline void this_cpu_enable_ftrace(void)
0098 {
0099 get_paca()->ftrace_enabled = 1;
0100 }
0101
0102
0103 static inline void this_cpu_set_ftrace_enabled(u8 ftrace_enabled)
0104 {
0105 get_paca()->ftrace_enabled = ftrace_enabled;
0106 }
0107
0108 static inline u8 this_cpu_get_ftrace_enabled(void)
0109 {
0110 return get_paca()->ftrace_enabled;
0111 }
0112
0113 void ftrace_free_init_tramp(void);
0114 #else
0115 static inline void this_cpu_disable_ftrace(void) { }
0116 static inline void this_cpu_enable_ftrace(void) { }
0117 static inline void this_cpu_set_ftrace_enabled(u8 ftrace_enabled) { }
0118 static inline u8 this_cpu_get_ftrace_enabled(void) { return 1; }
0119 static inline void ftrace_free_init_tramp(void) { }
0120 #endif
0121 #endif
0122
0123 #endif