1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_X86_UNWIND_USER_H
3#define _ASM_X86_UNWIND_USER_H
4
5#ifdef CONFIG_HAVE_UNWIND_USER_FP
6
7#include <asm/ptrace.h>
8#include <asm/uprobes.h>
9
10#define ARCH_INIT_USER_FP_FRAME(ws) \
11 .cfa_off = 2*(ws), \
12 .ra_off = -1*(ws), \
13 .fp_off = -2*(ws), \
14 .use_fp = true,
15
16#define ARCH_INIT_USER_FP_ENTRY_FRAME(ws) \
17 .cfa_off = 1*(ws), \
18 .ra_off = -1*(ws), \
19 .fp_off = 0, \
20 .use_fp = false,
21
22static inline int unwind_user_word_size(struct pt_regs *regs)
23{
24 /* We can't unwind VM86 stacks */
25 if (regs->flags & X86_VM_MASK)
26 return 0;
27#ifdef CONFIG_X86_64
28 if (!user_64bit_mode(regs))
29 return sizeof(int);
30#endif
31 return sizeof(long);
32}
33
34static inline bool unwind_user_at_function_start(struct pt_regs *regs)
35{
36 return is_uprobe_at_func_entry(regs);
37}
38
39#endif /* CONFIG_HAVE_UNWIND_USER_FP */
40
41#endif /* _ASM_X86_UNWIND_USER_H */
42

source code of linux/arch/x86/include/asm/unwind_user.h