~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/perf/util/disasm.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  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_allocated;
 25         struct ins_ops  *(*associate_instruction_ops)(struct arch *arch, const char *name);
 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 *arch, char *cpuid);
 33         bool            (*ins_is_fused)(struct arch *arch, const char *ins1,
 34                                         const char *ins2);
 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)(struct type_state *state,
 44                                 struct data_loc_info *dloc, Dwarf_Die *cu_die,
 45                                 struct disasm_line *dl);
 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          ins;
 77                         struct ins_operands *ops;
 78                 } locked;
 79                 struct {
 80                         char    *raw_comment;
 81                         char    *raw_func_start;
 82                 } jump;
 83         };
 84 };
 85 
 86 struct ins_ops {
 87         void (*free)(struct ins_operands *ops);
 88         int (*parse)(struct arch *arch, struct ins_operands *ops, struct map_symbol *ms,
 89                         struct disasm_line *dl);
 90         int (*scnprintf)(struct ins *ins, char *bf, size_t size,
 91                          struct ins_operands *ops, int max_ins_name);
 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 *name);
107 
108 struct ins_ops *ins__find(struct arch *arch, const char *name, struct disasm_line *dl);
109 int ins__scnprintf(struct ins *ins, char *bf, size_t size,
110                    struct ins_operands *ops, int max_ins_name);
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 char *ins1, const char *ins2);
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 annotate_args *args);
120 void disasm_line__free(struct disasm_line *dl);
121 
122 int disasm_line__scnprintf(struct disasm_line *dl, char *bf, size_t size,
123                            bool raw, int max_ins_name);
124 
125 int symbol__disassemble(struct symbol *sym, struct annotate_args *args);
126 
127 #endif /* __PERF_UTIL_DISASM_H */
128 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php