Merge tag 'powerpc-5.11-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[linux/fpc-iii.git] / tools / objtool / arch.h
blob4a84c3081b8e131572b32c9e02a7dfbcf8c40068
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 * Copyright (C) 2015 Josh Poimboeuf <jpoimboe@redhat.com>
4 */
6 #ifndef _ARCH_H
7 #define _ARCH_H
9 #include <stdbool.h>
10 #include <linux/list.h>
11 #include "objtool.h"
12 #include "cfi.h"
14 #ifdef INSN_USE_ORC
15 #include <asm/orc_types.h>
16 #endif
18 enum insn_type {
19 INSN_JUMP_CONDITIONAL,
20 INSN_JUMP_UNCONDITIONAL,
21 INSN_JUMP_DYNAMIC,
22 INSN_JUMP_DYNAMIC_CONDITIONAL,
23 INSN_CALL,
24 INSN_CALL_DYNAMIC,
25 INSN_RETURN,
26 INSN_CONTEXT_SWITCH,
27 INSN_BUG,
28 INSN_NOP,
29 INSN_STAC,
30 INSN_CLAC,
31 INSN_STD,
32 INSN_CLD,
33 INSN_OTHER,
36 enum op_dest_type {
37 OP_DEST_REG,
38 OP_DEST_REG_INDIRECT,
39 OP_DEST_MEM,
40 OP_DEST_PUSH,
41 OP_DEST_PUSHF,
42 OP_DEST_LEAVE,
45 struct op_dest {
46 enum op_dest_type type;
47 unsigned char reg;
48 int offset;
51 enum op_src_type {
52 OP_SRC_REG,
53 OP_SRC_REG_INDIRECT,
54 OP_SRC_CONST,
55 OP_SRC_POP,
56 OP_SRC_POPF,
57 OP_SRC_ADD,
58 OP_SRC_AND,
61 struct op_src {
62 enum op_src_type type;
63 unsigned char reg;
64 int offset;
67 struct stack_op {
68 struct op_dest dest;
69 struct op_src src;
70 struct list_head list;
73 struct instruction;
75 void arch_initial_func_cfi_state(struct cfi_init_state *state);
77 int arch_decode_instruction(const struct elf *elf, const struct section *sec,
78 unsigned long offset, unsigned int maxlen,
79 unsigned int *len, enum insn_type *type,
80 unsigned long *immediate,
81 struct list_head *ops_list);
83 bool arch_callee_saved_reg(unsigned char reg);
85 unsigned long arch_jump_destination(struct instruction *insn);
87 unsigned long arch_dest_reloc_offset(int addend);
89 const char *arch_nop_insn(int len);
91 int arch_decode_hint_reg(struct instruction *insn, u8 sp_reg);
93 #endif /* _ARCH_H */