1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright (C) 2017 Josh Poimboeuf <jpoimboe@redhat.com>
15 unsigned int uaccess_stack;
24 * Pointer from a replacement group to the original group. NULL if it
25 * *is* the original group.
27 struct alt_group *orig_group;
29 /* First and last instructions in the group */
30 struct instruction *first_insn, *last_insn;
33 * Byte-offset-addressed len-sized array of pointers to CFI structs.
34 * This is shared with the other alt_groups in the same alternative.
36 struct cfi_state **cfi;
40 struct list_head list;
41 struct hlist_node hash;
42 struct list_head call_node;
47 unsigned long immediate;
48 bool dead_end, ignore, ignore_alts;
55 struct alt_group *alt_group;
56 struct symbol *call_dest;
57 struct instruction *jump_dest;
58 struct instruction *first_jump_src;
59 struct reloc *jump_table;
61 struct list_head alts;
63 struct list_head stack_ops;
64 struct cfi_state *cfi;
67 #define VISITED_BRANCH 0x01
68 #define VISITED_BRANCH_UACCESS 0x02
69 #define VISITED_BRANCH_MASK 0x03
70 #define VISITED_ENTRY 0x04
72 static inline bool is_static_jump(struct instruction *insn)
74 return insn->type == INSN_JUMP_CONDITIONAL ||
75 insn->type == INSN_JUMP_UNCONDITIONAL;
78 static inline bool is_dynamic_jump(struct instruction *insn)
80 return insn->type == INSN_JUMP_DYNAMIC ||
81 insn->type == INSN_JUMP_DYNAMIC_CONDITIONAL;
84 static inline bool is_jump(struct instruction *insn)
86 return is_static_jump(insn) || is_dynamic_jump(insn);
89 struct instruction *find_insn(struct objtool_file *file,
90 struct section *sec, unsigned long offset);
92 #define for_each_insn(file, insn) \
93 list_for_each_entry(insn, &file->insn_list, list)
95 #define sec_for_each_insn(file, sec, insn) \
96 for (insn = find_insn(file, sec, 0); \
97 insn && &insn->list != &file->insn_list && \
99 insn = list_next_entry(insn, list))
101 #endif /* _CHECK_H */