1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Copyright (C) 2015-2017 Josh Poimboeuf <jpoimboe@redhat.com>
4  */
5 
6 #ifndef _OBJTOOL_CFI_H
7 #define _OBJTOOL_CFI_H
8 
9 #include <arch/cfi_regs.h>
10 #include <linux/list.h>
11 
12 #define CFI_UNDEFINED		-1
13 #define CFI_CFA			-2
14 #define CFI_SP_INDIRECT		-3
15 #define CFI_BP_INDIRECT		-4
16 
17 struct cfi_reg {
18 	int base;
19 	int offset;
20 };
21 
22 struct cfi_init_state {
23 	struct cfi_reg regs[CFI_NUM_REGS];
24 	struct cfi_reg cfa;
25 };
26 
27 struct cfi_state {
28 	struct hlist_node hash; /* must be first, cficmp() */
29 	struct cfi_reg regs[CFI_NUM_REGS];
30 	struct cfi_reg vals[CFI_NUM_REGS];
31 	struct cfi_reg cfa;
32 	int stack_size;
33 	int drap_reg, drap_offset;
34 	unsigned char type;
35 	bool bp_scratch;
36 	bool drap;
37 	bool signal;
38 	bool end;
39 	bool force_undefined;
40 };
41 
42 #endif /* _OBJTOOL_CFI_H */
43