]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - tools/objtool/arch.h
Merge tag 'v5.9-rc2' into drm-misc-fixes
[mirror_ubuntu-jammy-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
0decf1f8
MH
14#include <asm/orc_types.h>
15
9fe7b764
JP
16enum insn_type {
17 INSN_JUMP_CONDITIONAL,
18 INSN_JUMP_UNCONDITIONAL,
19 INSN_JUMP_DYNAMIC,
b68b9907 20 INSN_JUMP_DYNAMIC_CONDITIONAL,
9fe7b764
JP
21 INSN_CALL,
22 INSN_CALL_DYNAMIC,
23 INSN_RETURN,
24 INSN_CONTEXT_SWITCH,
9fe7b764
JP
25 INSN_BUG,
26 INSN_NOP,
27 INSN_STAC,
28 INSN_CLAC,
29 INSN_STD,
30 INSN_CLD,
31 INSN_OTHER,
32};
442f04c3 33
baa41469
JP
34enum op_dest_type {
35 OP_DEST_REG,
36 OP_DEST_REG_INDIRECT,
37 OP_DEST_MEM,
38 OP_DEST_PUSH,
ea24213d 39 OP_DEST_PUSHF,
baa41469
JP
40 OP_DEST_LEAVE,
41};
42
43struct op_dest {
44 enum op_dest_type type;
45 unsigned char reg;
46 int offset;
47};
48
49enum op_src_type {
50 OP_SRC_REG,
51 OP_SRC_REG_INDIRECT,
52 OP_SRC_CONST,
53 OP_SRC_POP,
ea24213d 54 OP_SRC_POPF,
baa41469
JP
55 OP_SRC_ADD,
56 OP_SRC_AND,
57};
58
59struct op_src {
60 enum op_src_type type;
61 unsigned char reg;
62 int offset;
63};
64
65struct stack_op {
66 struct op_dest dest;
67 struct op_src src;
65ea47dc 68 struct list_head list;
baa41469
JP
69};
70
bfb08f22
RG
71struct instruction;
72
a3608f59 73void arch_initial_func_cfi_state(struct cfi_init_state *state);
baa41469 74
0c98be81 75int arch_decode_instruction(const struct elf *elf, const struct section *sec,
442f04c3 76 unsigned long offset, unsigned int maxlen,
9fe7b764 77 unsigned int *len, enum insn_type *type,
65ea47dc
JT
78 unsigned long *immediate,
79 struct list_head *ops_list);
baa41469
JP
80
81bool arch_callee_saved_reg(unsigned char reg);
442f04c3 82
bfb08f22
RG
83unsigned long arch_jump_destination(struct instruction *insn);
84
f1974222 85unsigned long arch_dest_reloc_offset(int addend);
bfb08f22 86
0f1441b4
PZ
87const char *arch_nop_insn(int len);
88
442f04c3 89#endif /* _ARCH_H */