summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/perf/callchain.h
blob: 7a2cb9e1181a717265ec018ae8854aa895a52217 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef _POWERPC_PERF_CALLCHAIN_H
#define _POWERPC_PERF_CALLCHAIN_H

int read_user_stack_slow(void __user *ptr, void *buf, int nb);
void perf_callchain_user_64(struct perf_callchain_entry_ctx *entry,
			    struct pt_regs *regs);
void perf_callchain_user_32(struct perf_callchain_entry_ctx *entry,
			    struct pt_regs *regs);

static inline bool invalid_user_sp(unsigned long sp)
{
	unsigned long mask = is_32bit_task() ? 3 : 7;
	unsigned long top = STACK_TOP - (is_32bit_task() ? 16 : 32);

	return (!sp || (sp & mask) || (sp > top));
}

#endif /* _POWERPC_PERF_CALLCHAIN_H */