1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_OBJTOOL_TYPES_H
3 #define _LINUX_OBJTOOL_TYPES_H
4 
5 #ifndef __ASSEMBLY__
6 
7 #include <linux/types.h>
8 
9 /*
10  * This struct is used by asm and inline asm code to manually annotate the
11  * location of registers on the stack.
12  */
13 struct unwind_hint {
14 	u32		ip;
15 	s16		sp_offset;
16 	u8		sp_reg;
17 	u8		type;
18 	u8		signal;
19 };
20 
21 #endif /* __ASSEMBLY__ */
22 
23 /*
24  * UNWIND_HINT_TYPE_UNDEFINED: A blind spot in ORC coverage which can result in
25  * a truncated and unreliable stack unwind.
26  *
27  * UNWIND_HINT_TYPE_END_OF_STACK: The end of the kernel stack unwind before
28  * hitting user entry, boot code, or fork entry (when there are no pt_regs
29  * available).
30  *
31  * UNWIND_HINT_TYPE_CALL: Indicates that sp_reg+sp_offset resolves to PREV_SP
32  * (the caller's SP right before it made the call).  Used for all callable
33  * functions, i.e. all C code and all callable asm functions.
34  *
35  * UNWIND_HINT_TYPE_REGS: Used in entry code to indicate that sp_reg+sp_offset
36  * points to a fully populated pt_regs from a syscall, interrupt, or exception.
37  *
38  * UNWIND_HINT_TYPE_REGS_PARTIAL: Used in entry code to indicate that
39  * sp_reg+sp_offset points to the iret return frame.
40  *
41  * UNWIND_HINT_TYPE_FUNC: Generate the unwind metadata of a callable function.
42  * Useful for code which doesn't have an ELF function annotation.
43  *
44  * UNWIND_HINT_TYPE_{SAVE,RESTORE}: Save the unwind metadata at a certain
45  * location so that it can be restored later.
46  */
47 #define UNWIND_HINT_TYPE_UNDEFINED	0
48 #define UNWIND_HINT_TYPE_END_OF_STACK	1
49 #define UNWIND_HINT_TYPE_CALL		2
50 #define UNWIND_HINT_TYPE_REGS		3
51 #define UNWIND_HINT_TYPE_REGS_PARTIAL	4
52 /* The below hint types don't have corresponding ORC types */
53 #define UNWIND_HINT_TYPE_FUNC		5
54 #define UNWIND_HINT_TYPE_SAVE		6
55 #define UNWIND_HINT_TYPE_RESTORE	7
56 
57 #endif /* _LINUX_OBJTOOL_TYPES_H */
58