David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2015-2017 Josh Poimboeuf <jpoimboe@redhat.com> |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #ifndef _OBJTOOL_CFI_H |
| 7 | #define _OBJTOOL_CFI_H |
| 8 | |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame] | 9 | #include "cfi_regs.h" |
Olivier Deprez | 92d4c21 | 2022-12-06 15:05:30 +0100 | [diff] [blame^] | 10 | #include <linux/list.h> |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame] | 11 | |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 12 | #define CFI_UNDEFINED -1 |
| 13 | #define CFI_CFA -2 |
| 14 | #define CFI_SP_INDIRECT -3 |
| 15 | #define CFI_BP_INDIRECT -4 |
| 16 | |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 17 | struct cfi_reg { |
| 18 | int base; |
| 19 | int offset; |
| 20 | }; |
| 21 | |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame] | 22 | struct cfi_init_state { |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 23 | struct cfi_reg regs[CFI_NUM_REGS]; |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame] | 24 | struct cfi_reg cfa; |
| 25 | }; |
| 26 | |
| 27 | struct cfi_state { |
Olivier Deprez | 92d4c21 | 2022-12-06 15:05:30 +0100 | [diff] [blame^] | 28 | struct hlist_node hash; /* must be first, cficmp() */ |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame] | 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 end; |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | #endif /* _OBJTOOL_CFI_H */ |