Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags   |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) #ifndef _ASM_X86_FTRACE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) #define _ASM_X86_FTRACE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) #ifdef CONFIG_FUNCTION_TRACER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #ifndef CC_USING_FENTRY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) # error Compiler does not support fentry?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) # define MCOUNT_ADDR		((unsigned long)(__fentry__))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #define MCOUNT_INSN_SIZE	5 /* sizeof mcount call */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #ifdef CONFIG_DYNAMIC_FTRACE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #define ARCH_SUPPORTS_FTRACE_OPS 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #ifndef __ASSEMBLY__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) extern atomic_t modifying_ftrace_code;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) extern void __fentry__(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) static inline unsigned long ftrace_call_adjust(unsigned long addr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	 * addr is the address of the mcount call instruction.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	 * recordmcount does the necessary offset calculation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	return addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  * When a ftrace registered caller is tracing a function that is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  * also set by a register_ftrace_direct() call, it needs to be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  * differentiated in the ftrace_caller trampoline. To do this, we
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  * place the direct caller in the ORIG_AX part of pt_regs. This
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  * tells the ftrace_caller that there's a direct caller.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) static inline void arch_ftrace_set_direct_caller(struct pt_regs *regs, unsigned long addr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	/* Emulate a call */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	regs->orig_ax = addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) #ifdef CONFIG_DYNAMIC_FTRACE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) struct dyn_arch_ftrace {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	/* No extra data needed for x86 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) #define FTRACE_GRAPH_TRAMP_ADDR FTRACE_GRAPH_ADDR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) #endif /*  CONFIG_DYNAMIC_FTRACE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) #endif /* __ASSEMBLY__ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) #endif /* CONFIG_FUNCTION_TRACER */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) #ifndef __ASSEMBLY__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) #if defined(CONFIG_FUNCTION_TRACER) && defined(CONFIG_DYNAMIC_FTRACE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) extern void set_ftrace_ops_ro(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) static inline void set_ftrace_ops_ro(void) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) #define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) static inline bool arch_syscall_match_sym_name(const char *sym, const char *name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	 * Compare the symbol name with the system call name. Skip the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	 * "__x64_sys", "__ia32_sys", "__do_sys" or simple "sys" prefix.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	return !strcmp(sym + 3, name + 3) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 		(!strncmp(sym, "__x64_", 6) && !strcmp(sym + 9, name + 3)) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 		(!strncmp(sym, "__ia32_", 7) && !strcmp(sym + 10, name + 3)) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 		(!strncmp(sym, "__do_sys", 8) && !strcmp(sym + 8, name + 3));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) #ifndef COMPILE_OFFSETS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) #if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_IA32_EMULATION)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) #include <linux/compat.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84)  * Because ia32 syscalls do not map to x86_64 syscall numbers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)  * this screws up the trace output when tracing a ia32 task.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)  * Instead of reporting bogus syscalls, just do not trace them.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88)  * If the user really wants these, then they should use the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)  * raw syscall tracepoints with filtering.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) #define ARCH_TRACE_IGNORE_COMPAT_SYSCALLS 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	return in_32bit_syscall();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) #endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_IA32_EMULATION */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) #endif /* !COMPILE_OFFSETS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) #endif /* !__ASSEMBLY__ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #endif /* _ASM_X86_FTRACE_H */