Linux Audio

Check our new training course

Loading...
v4.17
 
 1/*
 2 * Copyright (C) 2015 Josh Poimboeuf <jpoimboe@redhat.com>
 3 *
 4 * This program is free software; you can redistribute it and/or
 5 * modify it under the terms of the GNU General Public License
 6 * as published by the Free Software Foundation; either version 2
 7 * of the License, or (at your option) any later version.
 8 *
 9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef _ARCH_H
19#define _ARCH_H
20
21#include <stdbool.h>
22#include <linux/list.h>
23#include "elf.h"
24#include "cfi.h"
25
26#define INSN_JUMP_CONDITIONAL	1
27#define INSN_JUMP_UNCONDITIONAL	2
28#define INSN_JUMP_DYNAMIC	3
29#define INSN_CALL		4
30#define INSN_CALL_DYNAMIC	5
31#define INSN_RETURN		6
32#define INSN_CONTEXT_SWITCH	7
33#define INSN_STACK		8
34#define INSN_BUG		9
35#define INSN_NOP		10
36#define INSN_OTHER		11
37#define INSN_LAST		INSN_OTHER
 
 
 
 
 
 
 
38
39enum op_dest_type {
40	OP_DEST_REG,
41	OP_DEST_REG_INDIRECT,
42	OP_DEST_MEM,
43	OP_DEST_PUSH,
 
44	OP_DEST_LEAVE,
45};
46
47struct op_dest {
48	enum op_dest_type type;
49	unsigned char reg;
50	int offset;
51};
52
53enum op_src_type {
54	OP_SRC_REG,
55	OP_SRC_REG_INDIRECT,
56	OP_SRC_CONST,
57	OP_SRC_POP,
 
58	OP_SRC_ADD,
59	OP_SRC_AND,
60};
61
62struct op_src {
63	enum op_src_type type;
64	unsigned char reg;
65	int offset;
66};
67
68struct stack_op {
69	struct op_dest dest;
70	struct op_src src;
 
71};
72
73void arch_initial_func_cfi_state(struct cfi_state *state);
 
 
74
75int arch_decode_instruction(struct elf *elf, struct section *sec,
76			    unsigned long offset, unsigned int maxlen,
77			    unsigned int *len, unsigned char *type,
78			    unsigned long *immediate, struct stack_op *op);
 
79
80bool arch_callee_saved_reg(unsigned char reg);
 
 
 
 
 
 
81
82#endif /* _ARCH_H */
v5.9
 1/* SPDX-License-Identifier: GPL-2.0-or-later */
 2/*
 3 * Copyright (C) 2015 Josh Poimboeuf <jpoimboe@redhat.com>
 
 
 
 
 
 
 
 
 
 
 
 
 
 4 */
 5
 6#ifndef _ARCH_H
 7#define _ARCH_H
 8
 9#include <stdbool.h>
10#include <linux/list.h>
11#include "objtool.h"
12#include "cfi.h"
13
14#include <asm/orc_types.h>
15
16enum insn_type {
17	INSN_JUMP_CONDITIONAL,
18	INSN_JUMP_UNCONDITIONAL,
19	INSN_JUMP_DYNAMIC,
20	INSN_JUMP_DYNAMIC_CONDITIONAL,
21	INSN_CALL,
22	INSN_CALL_DYNAMIC,
23	INSN_RETURN,
24	INSN_CONTEXT_SWITCH,
25	INSN_BUG,
26	INSN_NOP,
27	INSN_STAC,
28	INSN_CLAC,
29	INSN_STD,
30	INSN_CLD,
31	INSN_OTHER,
32};
33
34enum op_dest_type {
35	OP_DEST_REG,
36	OP_DEST_REG_INDIRECT,
37	OP_DEST_MEM,
38	OP_DEST_PUSH,
39	OP_DEST_PUSHF,
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,
54	OP_SRC_POPF,
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;
68	struct list_head list;
69};
70
71struct instruction;
72
73void arch_initial_func_cfi_state(struct cfi_init_state *state);
74
75int arch_decode_instruction(const struct elf *elf, const struct section *sec,
76			    unsigned long offset, unsigned int maxlen,
77			    unsigned int *len, enum insn_type *type,
78			    unsigned long *immediate,
79			    struct list_head *ops_list);
80
81bool arch_callee_saved_reg(unsigned char reg);
82
83unsigned long arch_jump_destination(struct instruction *insn);
84
85unsigned long arch_dest_reloc_offset(int addend);
86
87const char *arch_nop_insn(int len);
88
89#endif /* _ARCH_H */