blob: f579802d7ec241c3f5b931d53bee2b3a6744d6be [file] [log] [blame]
David Brazdil0f672f62019-12-10 10:32:29 +00001/* SPDX-License-Identifier: GPL-2.0-or-later */
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002/*
3 * Copyright (C) 2015-2017 Josh Poimboeuf <jpoimboe@redhat.com>
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004 */
5
6#ifndef _OBJTOOL_CFI_H
7#define _OBJTOOL_CFI_H
8
Olivier Deprez157378f2022-04-04 15:47:50 +02009#include "cfi_regs.h"
Olivier Deprez92d4c212022-12-06 15:05:30 +010010#include <linux/list.h>
Olivier Deprez157378f2022-04-04 15:47:50 +020011
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000012#define CFI_UNDEFINED -1
13#define CFI_CFA -2
14#define CFI_SP_INDIRECT -3
15#define CFI_BP_INDIRECT -4
16
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000017struct cfi_reg {
18 int base;
19 int offset;
20};
21
Olivier Deprez157378f2022-04-04 15:47:50 +020022struct cfi_init_state {
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000023 struct cfi_reg regs[CFI_NUM_REGS];
Olivier Deprez157378f2022-04-04 15:47:50 +020024 struct cfi_reg cfa;
25};
26
27struct cfi_state {
Olivier Deprez92d4c212022-12-06 15:05:30 +010028 struct hlist_node hash; /* must be first, cficmp() */
Olivier Deprez157378f2022-04-04 15:47:50 +020029 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 Scullb4b6d4a2019-01-02 15:54:55 +000038};
39
40#endif /* _OBJTOOL_CFI_H */