]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blame - tools/objtool/arch.h
Merge tag 'fixes-v5.10a' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[mirror_ubuntu-hirsute-kernel.git] / tools / objtool / arch.h
CommitLineData
1ccea77e 1/* SPDX-License-Identifier: GPL-2.0-or-later */
442f04c3
JP
2/*
3 * Copyright (C) 2015 Josh Poimboeuf <jpoimboe@redhat.com>
442f04c3
JP
4 */
5
6#ifndef _ARCH_H
7#define _ARCH_H
8
9#include <stdbool.h>
baa41469 10#include <linux/list.h>
0decf1f8 11#include "objtool.h"
baa41469 12#include "cfi.h"
442f04c3 13
66734e32 14#ifdef INSN_USE_ORC
0decf1f8 15#include <asm/orc_types.h>
66734e32 16#endif
0decf1f8 17
9fe7b764
JP
18enum insn_type {
19 INSN_JUMP_CONDITIONAL,
20 INSN_JUMP_UNCONDITIONAL,
21 INSN_JUMP_DYNAMIC,
b68b9907 22 INSN_JUMP_DYNAMIC_CONDITIONAL,
9fe7b764
JP
23 INSN_CALL,
24 INSN_CALL_DYNAMIC,
25 INSN_RETURN,
26 INSN_CONTEXT_SWITCH,
9fe7b764
JP
27 INSN_BUG,
28 INSN_NOP,
29 INSN_STAC,
30 INSN_CLAC,
31 INSN_STD,
32 INSN_CLD,
33 INSN_OTHER,
34};
442f04c3 35
baa41469
JP
36enum op_dest_type {
37 OP_DEST_REG,
38 OP_DEST_REG_INDIRECT,
39 OP_DEST_MEM,
40 OP_DEST_PUSH,
ea24213d 41 OP_DEST_PUSHF,
baa41469
JP
42 OP_DEST_LEAVE,
43};
44
45struct op_dest {
46 enum op_dest_type type;
47 unsigned char reg;
48 int offset;
49};
50
51enum op_src_type {
52 OP_SRC_REG,
53 OP_SRC_REG_INDIRECT,
54 OP_SRC_CONST,
55 OP_SRC_POP,
ea24213d 56 OP_SRC_POPF,
baa41469
JP
57 OP_SRC_ADD,
58 OP_SRC_AND,
59};
60
61struct op_src {
62 enum op_src_type type;
63 unsigned char reg;
64 int offset;
65};
66
67struct stack_op {
68 struct op_dest dest;
69 struct op_src src;
65ea47dc 70 struct list_head list;
baa41469
JP
71};
72
bfb08f22
RG
73struct instruction;
74
a3608f59 75void arch_initial_func_cfi_state(struct cfi_init_state *state);
baa41469 76
0c98be81 77int arch_decode_instruction(const struct elf *elf, const struct section *sec,
442f04c3 78 unsigned long offset, unsigned int maxlen,
9fe7b764 79 unsigned int *len, enum insn_type *type,
65ea47dc
JT
80 unsigned long *immediate,
81 struct list_head *ops_list);
baa41469
JP
82
83bool arch_callee_saved_reg(unsigned char reg);
442f04c3 84
bfb08f22
RG
85unsigned long arch_jump_destination(struct instruction *insn);
86
f1974222 87unsigned long arch_dest_reloc_offset(int addend);
bfb08f22 88
0f1441b4
PZ
89const char *arch_nop_insn(int len);
90
edea9e6b
JT
91int arch_decode_hint_reg(struct instruction *insn, u8 sp_reg);
92
442f04c3 93#endif /* _ARCH_H */