Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_ARM_FTRACE
0003 #define _ASM_ARM_FTRACE
0004 
0005 #define HAVE_FUNCTION_GRAPH_FP_TEST
0006 
0007 #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
0008 #define ARCH_SUPPORTS_FTRACE_OPS 1
0009 #endif
0010 
0011 #ifdef CONFIG_FUNCTION_TRACER
0012 #define MCOUNT_ADDR     ((unsigned long)(__gnu_mcount_nc))
0013 #define MCOUNT_INSN_SIZE    4 /* sizeof mcount call */
0014 
0015 #ifndef __ASSEMBLY__
0016 extern void __gnu_mcount_nc(void);
0017 
0018 #ifdef CONFIG_DYNAMIC_FTRACE
0019 struct dyn_arch_ftrace {
0020 #ifdef CONFIG_ARM_MODULE_PLTS
0021     struct module *mod;
0022 #endif
0023 };
0024 
0025 static inline unsigned long ftrace_call_adjust(unsigned long addr)
0026 {
0027     /* With Thumb-2, the recorded addresses have the lsb set */
0028     return addr & ~1;
0029 }
0030 #endif
0031 
0032 #endif
0033 
0034 #endif
0035 
0036 #ifndef __ASSEMBLY__
0037 
0038 #if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND)
0039 /*
0040  * return_address uses walk_stackframe to do it's work.  If both
0041  * CONFIG_FRAME_POINTER=y and CONFIG_ARM_UNWIND=y walk_stackframe uses unwind
0042  * information.  For this to work in the function tracer many functions would
0043  * have to be marked with __notrace.  So for now just depend on
0044  * !CONFIG_ARM_UNWIND.
0045  */
0046 
0047 void *return_address(unsigned int);
0048 
0049 #else
0050 
0051 static inline void *return_address(unsigned int level)
0052 {
0053        return NULL;
0054 }
0055 
0056 #endif
0057 
0058 #define ftrace_return_address(n) return_address(n)
0059 
0060 #define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
0061 
0062 static inline bool arch_syscall_match_sym_name(const char *sym,
0063                            const char *name)
0064 {
0065     if (!strcmp(sym, "sys_mmap2"))
0066         sym = "sys_mmap_pgoff";
0067     else if (!strcmp(sym, "sys_statfs64_wrapper"))
0068         sym = "sys_statfs64";
0069     else if (!strcmp(sym, "sys_fstatfs64_wrapper"))
0070         sym = "sys_fstatfs64";
0071     else if (!strcmp(sym, "sys_arm_fadvise64_64"))
0072         sym = "sys_fadvise64_64";
0073 
0074     /* Ignore case since sym may start with "SyS" instead of "sys" */
0075     return !strcasecmp(sym, name);
0076 }
0077 
0078 #endif /* ifndef __ASSEMBLY__ */
0079 
0080 #endif /* _ASM_ARM_FTRACE */