at v5.10 69 lines 1.6 kB view raw
1/* SPDX-License-Identifier: GPL-2.0-or-later */ 2/* 3 * Copyright (C) 2017 Josh Poimboeuf <jpoimboe@redhat.com> 4 */ 5 6#ifndef _CHECK_H 7#define _CHECK_H 8 9#include <stdbool.h> 10#include "cfi.h" 11#include "arch.h" 12 13struct insn_state { 14 struct cfi_state cfi; 15 unsigned int uaccess_stack; 16 bool uaccess; 17 bool df; 18 bool noinstr; 19 s8 instr; 20}; 21 22struct instruction { 23 struct list_head list; 24 struct hlist_node hash; 25 struct list_head static_call_node; 26 struct section *sec; 27 unsigned long offset; 28 unsigned int len; 29 enum insn_type type; 30 unsigned long immediate; 31 bool dead_end, ignore, ignore_alts; 32 bool hint; 33 bool retpoline_safe; 34 s8 instr; 35 u8 visited; 36 u8 ret_offset; 37 int alt_group; 38 struct symbol *call_dest; 39 struct instruction *jump_dest; 40 struct instruction *first_jump_src; 41 struct reloc *jump_table; 42 struct list_head alts; 43 struct symbol *func; 44 struct list_head stack_ops; 45 struct cfi_state cfi; 46#ifdef INSN_USE_ORC 47 struct orc_entry orc; 48#endif 49}; 50 51static inline bool is_static_jump(struct instruction *insn) 52{ 53 return insn->type == INSN_JUMP_CONDITIONAL || 54 insn->type == INSN_JUMP_UNCONDITIONAL; 55} 56 57struct instruction *find_insn(struct objtool_file *file, 58 struct section *sec, unsigned long offset); 59 60#define for_each_insn(file, insn) \ 61 list_for_each_entry(insn, &file->insn_list, list) 62 63#define sec_for_each_insn(file, sec, insn) \ 64 for (insn = find_insn(file, sec, 0); \ 65 insn && &insn->list != &file->insn_list && \ 66 insn->sec == sec; \ 67 insn = list_next_entry(insn, list)) 68 69#endif /* _CHECK_H */