1 // SPDX-License-Identifier: GPL-2.0 1 2 #ifndef __PERF_UTIL_DISASM_H 3 #define __PERF_UTIL_DISASM_H 4 5 #include "map_symbol.h" 6 7 #ifdef HAVE_DWARF_SUPPORT 8 #include "dwarf-aux.h" 9 #endif 10 11 struct annotation_options; 12 struct disasm_line; 13 struct ins; 14 struct evsel; 15 struct symbol; 16 struct data_loc_info; 17 struct type_state; 18 struct disasm_line; 19 20 struct arch { 21 const char *name; 22 struct ins *instructions; 23 size_t nr_instructions; 24 size_t nr_instructions_alloca 25 struct ins_ops *(*associate_instructi 26 bool sorted_instructions; 27 bool initialized; 28 const char *insn_suffix; 29 void *priv; 30 unsigned int model; 31 unsigned int family; 32 int (*init)(struct arch *a 33 bool (*ins_is_fused)(struct 34 const 35 struct { 36 char comment_char; 37 char skip_functions_char; 38 char register_char; 39 char memory_ref_char; 40 char imm_char; 41 } objdump; 42 #ifdef HAVE_DWARF_SUPPORT 43 void (*update_insn_state)(s 44 struct data_lo 45 struct disasm_ 46 #endif 47 }; 48 49 struct ins { 50 const char *name; 51 struct ins_ops *ops; 52 }; 53 54 struct ins_operands { 55 char *raw; 56 struct { 57 char *raw; 58 char *name; 59 struct symbol *sym; 60 u64 addr; 61 s64 offset; 62 bool offset_avail; 63 bool outside; 64 bool multi_regs; 65 bool mem_ref; 66 } target; 67 union { 68 struct { 69 char *raw; 70 char *name; 71 u64 addr; 72 bool multi_regs; 73 bool mem_ref; 74 } source; 75 struct { 76 struct ins in 77 struct ins_operands *o 78 } locked; 79 struct { 80 char *raw_comment; 81 char *raw_func_star 82 } jump; 83 }; 84 }; 85 86 struct ins_ops { 87 void (*free)(struct ins_operands *ops) 88 int (*parse)(struct arch *arch, struct 89 struct disasm_line *dl 90 int (*scnprintf)(struct ins *ins, char 91 struct ins_operands * 92 }; 93 94 struct annotate_args { 95 struct arch *arch; 96 struct map_symbol ms; 97 struct evsel *evsel; 98 struct annotation_options *options; 99 s64 offset; 100 char *line; 101 int line_nr; 102 char *fileloc; 103 }; 104 105 struct arch *arch__find(const char *name); 106 bool arch__is(struct arch *arch, const char *n 107 108 struct ins_ops *ins__find(struct arch *arch, c 109 int ins__scnprintf(struct ins *ins, char *bf, 110 struct ins_operands *ops, i 111 112 bool ins__is_call(const struct ins *ins); 113 bool ins__is_jump(const struct ins *ins); 114 bool ins__is_fused(struct arch *arch, const ch 115 bool ins__is_nop(const struct ins *ins); 116 bool ins__is_ret(const struct ins *ins); 117 bool ins__is_lock(const struct ins *ins); 118 119 struct disasm_line *disasm_line__new(struct an 120 void disasm_line__free(struct disasm_line *dl) 121 122 int disasm_line__scnprintf(struct disasm_line 123 bool raw, int max_i 124 125 int symbol__disassemble(struct symbol *sym, st 126 127 #endif /* __PERF_UTIL_DISASM_H */ 128
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.