| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2015-2017 Josh Poimboeuf <jpoimboe@redhat.com> |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or |
|---|
| 5 | | - * modify it under the terms of the GNU General Public License |
|---|
| 6 | | - * as published by the Free Software Foundation; either version 2 |
|---|
| 7 | | - * of the License, or (at your option) any later version. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 10 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 11 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 12 | | - * GNU General Public License for more details. |
|---|
| 13 | | - * |
|---|
| 14 | | - * You should have received a copy of the GNU General Public License |
|---|
| 15 | | - * along with this program; if not, see <http://www.gnu.org/licenses/>. |
|---|
| 16 | 4 | */ |
|---|
| 17 | 5 | |
|---|
| 18 | 6 | #ifndef _OBJTOOL_CFI_H |
|---|
| 19 | 7 | #define _OBJTOOL_CFI_H |
|---|
| 8 | + |
|---|
| 9 | +#include "cfi_regs.h" |
|---|
| 10 | +#include <linux/list.h> |
|---|
| 20 | 11 | |
|---|
| 21 | 12 | #define CFI_UNDEFINED -1 |
|---|
| 22 | 13 | #define CFI_CFA -2 |
|---|
| 23 | 14 | #define CFI_SP_INDIRECT -3 |
|---|
| 24 | 15 | #define CFI_BP_INDIRECT -4 |
|---|
| 25 | 16 | |
|---|
| 26 | | -#define CFI_AX 0 |
|---|
| 27 | | -#define CFI_DX 1 |
|---|
| 28 | | -#define CFI_CX 2 |
|---|
| 29 | | -#define CFI_BX 3 |
|---|
| 30 | | -#define CFI_SI 4 |
|---|
| 31 | | -#define CFI_DI 5 |
|---|
| 32 | | -#define CFI_BP 6 |
|---|
| 33 | | -#define CFI_SP 7 |
|---|
| 34 | | -#define CFI_R8 8 |
|---|
| 35 | | -#define CFI_R9 9 |
|---|
| 36 | | -#define CFI_R10 10 |
|---|
| 37 | | -#define CFI_R11 11 |
|---|
| 38 | | -#define CFI_R12 12 |
|---|
| 39 | | -#define CFI_R13 13 |
|---|
| 40 | | -#define CFI_R14 14 |
|---|
| 41 | | -#define CFI_R15 15 |
|---|
| 42 | | -#define CFI_RA 16 |
|---|
| 43 | | -#define CFI_NUM_REGS 17 |
|---|
| 44 | | - |
|---|
| 45 | 17 | struct cfi_reg { |
|---|
| 46 | 18 | int base; |
|---|
| 47 | 19 | int offset; |
|---|
| 48 | 20 | }; |
|---|
| 49 | 21 | |
|---|
| 50 | | -struct cfi_state { |
|---|
| 51 | | - struct cfi_reg cfa; |
|---|
| 22 | +struct cfi_init_state { |
|---|
| 52 | 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 end; |
|---|
| 53 | 38 | }; |
|---|
| 54 | 39 | |
|---|
| 55 | 40 | #endif /* _OBJTOOL_CFI_H */ |
|---|