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