xref: /openbmc/linux/arch/powerpc/perf/callchain.h (revision b8265621)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 #ifndef _POWERPC_PERF_CALLCHAIN_H
3 #define _POWERPC_PERF_CALLCHAIN_H
4 
5 int read_user_stack_slow(void __user *ptr, void *buf, int nb);
6 void perf_callchain_user_64(struct perf_callchain_entry_ctx *entry,
7 			    struct pt_regs *regs);
8 void perf_callchain_user_32(struct perf_callchain_entry_ctx *entry,
9 			    struct pt_regs *regs);
10 
11 static inline bool invalid_user_sp(unsigned long sp)
12 {
13 	unsigned long mask = is_32bit_task() ? 3 : 7;
14 	unsigned long top = STACK_TOP - (is_32bit_task() ? 16 : 32);
15 
16 	return (!sp || (sp & mask) || (sp > top));
17 }
18 
19 #endif /* _POWERPC_PERF_CALLCHAIN_H */
20