xref: /linux-6.15/include/linux/objtool_types.h (revision f902cfdd)
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 	u8		end;
20 };
21 
22 #endif /* __ASSEMBLY__ */
23 
24 /*
25  * UNWIND_HINT_TYPE_CALL: Indicates that sp_reg+sp_offset resolves to PREV_SP
26  * (the caller's SP right before it made the call).  Used for all callable
27  * functions, i.e. all C code and all callable asm functions.
28  *
29  * UNWIND_HINT_TYPE_REGS: Used in entry code to indicate that sp_reg+sp_offset
30  * points to a fully populated pt_regs from a syscall, interrupt, or exception.
31  *
32  * UNWIND_HINT_TYPE_REGS_PARTIAL: Used in entry code to indicate that
33  * sp_reg+sp_offset points to the iret return frame.
34  *
35  * UNWIND_HINT_FUNC: Generate the unwind metadata of a callable function.
36  * Useful for code which doesn't have an ELF function annotation.
37  *
38  * UNWIND_HINT_ENTRY: machine entry without stack, SYSCALL/SYSENTER etc.
39  */
40 #define UNWIND_HINT_TYPE_CALL		0
41 #define UNWIND_HINT_TYPE_REGS		1
42 #define UNWIND_HINT_TYPE_REGS_PARTIAL	2
43 /* The below hint types don't have corresponding ORC types */
44 #define UNWIND_HINT_TYPE_FUNC		3
45 #define UNWIND_HINT_TYPE_ENTRY		4
46 #define UNWIND_HINT_TYPE_SAVE		5
47 #define UNWIND_HINT_TYPE_RESTORE	6
48 
49 #endif /* _LINUX_OBJTOOL_TYPES_H */
50