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 "elf.h" 12 #include "cfi.h" 13 14 #define INSN_JUMP_CONDITIONAL 1 15 #define INSN_JUMP_UNCONDITIONAL 2 16 #define INSN_JUMP_DYNAMIC 3 17 #define INSN_CALL 4 18 #define INSN_CALL_DYNAMIC 5 19 #define INSN_RETURN 6 20 #define INSN_CONTEXT_SWITCH 7 21 #define INSN_STACK 8 22 #define INSN_BUG 9 23 #define INSN_NOP 10 24 #define INSN_STAC 11 25 #define INSN_CLAC 12 26 #define INSN_STD 13 27 #define INSN_CLD 14 28 #define INSN_OTHER 15 29 #define INSN_LAST INSN_OTHER 30 31 enum op_dest_type { 32 OP_DEST_REG, 33 OP_DEST_REG_INDIRECT, 34 OP_DEST_MEM, 35 OP_DEST_PUSH, 36 OP_DEST_PUSHF, 37 OP_DEST_LEAVE, 38 }; 39 40 struct op_dest { 41 enum op_dest_type type; 42 unsigned char reg; 43 int offset; 44 }; 45 46 enum op_src_type { 47 OP_SRC_REG, 48 OP_SRC_REG_INDIRECT, 49 OP_SRC_CONST, 50 OP_SRC_POP, 51 OP_SRC_POPF, 52 OP_SRC_ADD, 53 OP_SRC_AND, 54 }; 55 56 struct op_src { 57 enum op_src_type type; 58 unsigned char reg; 59 int offset; 60 }; 61 62 struct stack_op { 63 struct op_dest dest; 64 struct op_src src; 65 }; 66 67 void arch_initial_func_cfi_state(struct cfi_state *state); 68 69 int arch_decode_instruction(struct elf *elf, struct section *sec, 70 unsigned long offset, unsigned int maxlen, 71 unsigned int *len, unsigned char *type, 72 unsigned long *immediate, struct stack_op *op); 73 74 bool arch_callee_saved_reg(unsigned char reg); 75 76 #endif /* _ARCH_H */ 77
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.