Linux Audio

Check our new training course

Loading...
v5.4
 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 "elf.h"
11#include "cfi.h"
12#include "arch.h"
13#include "orc.h"
14#include <linux/hashtable.h>
15
16struct insn_state {
17	struct cfi_reg cfa;
18	struct cfi_reg regs[CFI_NUM_REGS];
19	int stack_size;
20	unsigned char type;
21	bool bp_scratch;
22	bool drap, end, uaccess, df;
23	unsigned int uaccess_stack;
24	int drap_reg, drap_offset;
25	struct cfi_reg vals[CFI_NUM_REGS];
 
 
26};
27
28struct instruction {
29	struct list_head list;
30	struct hlist_node hash;
31	struct section *sec;
32	unsigned long offset;
33	unsigned int len;
34	enum insn_type type;
35	unsigned long immediate;
36	bool alt_group, dead_end, ignore, hint, save, restore, ignore_alts;
 
37	bool retpoline_safe;
 
38	u8 visited;
 
 
39	struct symbol *call_dest;
40	struct instruction *jump_dest;
41	struct instruction *first_jump_src;
42	struct rela *jump_table;
43	struct list_head alts;
44	struct symbol *func;
45	struct stack_op stack_op;
46	struct insn_state state;
47	struct orc_entry orc;
48};
49
50struct objtool_file {
51	struct elf *elf;
52	struct list_head insn_list;
53	DECLARE_HASHTABLE(insn_hash, 16);
54	bool ignore_unreachables, c_file, hints, rodata;
55};
56
57int check(const char *objname, bool orc);
58
59struct instruction *find_insn(struct objtool_file *file,
60			      struct section *sec, unsigned long offset);
61
62#define for_each_insn(file, insn)					\
63	list_for_each_entry(insn, &file->insn_list, list)
64
65#define sec_for_each_insn(file, sec, insn)				\
66	for (insn = find_insn(file, sec, 0);				\
67	     insn && &insn->list != &file->insn_list &&			\
68			insn->sec == sec;				\
69	     insn = list_next_entry(insn, list))
70
71
72#endif /* _CHECK_H */
v5.9
 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 section *sec;
26	unsigned long offset;
27	unsigned int len;
28	enum insn_type type;
29	unsigned long immediate;
30	bool dead_end, ignore, ignore_alts;
31	bool hint;
32	bool retpoline_safe;
33	s8 instr;
34	u8 visited;
35	u8 ret_offset;
36	int alt_group;
37	struct symbol *call_dest;
38	struct instruction *jump_dest;
39	struct instruction *first_jump_src;
40	struct reloc *jump_table;
41	struct list_head alts;
42	struct symbol *func;
43	struct list_head stack_ops;
44	struct cfi_state cfi;
45	struct orc_entry orc;
46};
 
 
 
 
 
 
 
 
 
47
48struct instruction *find_insn(struct objtool_file *file,
49			      struct section *sec, unsigned long offset);
50
51#define for_each_insn(file, insn)					\
52	list_for_each_entry(insn, &file->insn_list, list)
53
54#define sec_for_each_insn(file, sec, insn)				\
55	for (insn = find_insn(file, sec, 0);				\
56	     insn && &insn->list != &file->insn_list &&			\
57			insn->sec == sec;				\
58	     insn = list_next_entry(insn, list))
59
60
61#endif /* _CHECK_H */