Coverage Report

Created: 2023-12-08 06:05

/src/capstonenext/Mapping.h
Line
Count
Source
1
/* Capstone Disassembly Engine */
2
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
3
/*    Rot127 <unisono@quyllur.org>, 2022-2023 */
4
5
#ifndef CS_MAPPING_H
6
#define CS_MAPPING_H
7
8
#if defined(CAPSTONE_HAS_OSXKERNEL)
9
#include <libkern/libkern.h>
10
#else
11
#include "include/capstone/capstone.h"
12
#include <stddef.h>
13
#endif
14
#include "cs_priv.h"
15
#include <assert.h>
16
#include <string.h>
17
18
// map instruction to its characteristics
19
typedef struct insn_map {
20
  unsigned short id;        // The LLVM instruction id
21
  unsigned short mapid;       // The Capstone instruction id
22
#ifndef CAPSTONE_DIET
23
  uint16_t regs_use[MAX_IMPL_R_REGS]; ///< list of implicit registers used by
24
              ///< this instruction
25
  uint16_t regs_mod[MAX_IMPL_W_REGS]; ///< list of implicit registers modified
26
              ///< by this instruction
27
  unsigned char groups
28
    [MAX_NUM_GROUPS]; ///< list of group this instruction belong to
29
  bool branch;      // branch instruction?
30
  bool indirect_branch;   // indirect branch instruction?
31
  union {
32
    ppc_suppl_info ppc;
33
  } suppl_info; // Supplementary information for each instruction.
34
#endif
35
} insn_map;
36
37
// look for @id in @m, given its size in @max. first time call will update
38
// @cache. return 0 if not found
39
unsigned short insn_find(const insn_map *m, unsigned int max, unsigned int id,
40
       unsigned short **cache);
41
42
unsigned int find_cs_id(unsigned MC_Opcode, const insn_map *imap,
43
      unsigned imap_size);
44
45
#define MAX_NO_DATA_TYPES 16
46
47
///< A LLVM<->CS Mapping entry of an MCOperand.
48
typedef struct {
49
  uint8_t /* cs_op_type */ type;   ///< Operand type (e.g.: reg, imm, mem)
50
  uint8_t /* cs_ac_type */ access; ///< The access type (read, write)
51
  uint8_t        /* cs_data_type */
52
    dtypes[MAX_NO_DATA_TYPES]; ///< List of op types. Terminated by
53
             ///< CS_DATA_TYPE_LAST
54
} mapping_op;
55
56
#define MAX_NO_INSN_MAP_OPS 16
57
58
///< MCOperands of an instruction.
59
typedef struct {
60
  mapping_op
61
    ops[MAX_NO_INSN_MAP_OPS]; ///< NULL terminated array of insn_op.
62
} map_insn_ops;
63
64
/// Only usable by `auto-sync` archs!
65
const cs_op_type mapping_get_op_type(MCInst *MI, unsigned OpNum,
66
             const map_insn_ops *insn_ops_map,
67
             size_t map_size);
68
69
/// Only usable by `auto-sync` archs!
70
const cs_ac_type mapping_get_op_access(MCInst *MI, unsigned OpNum,
71
               const map_insn_ops *insn_ops_map,
72
               size_t map_size);
73
74
/// Macro for easier access of operand types from the map.
75
/// Assumes the istruction operands map is called "insn_operands"
76
/// Only usable by `auto-sync` archs!
77
#define map_get_op_type(MI, OpNum) \
78
5.89M
  mapping_get_op_type(MI, OpNum, (const map_insn_ops *)insn_operands, \
79
5.89M
          sizeof(insn_operands) / sizeof(insn_operands[0]))
80
81
/// Macro for easier access of operand access flags from the map.
82
/// Assumes the istruction operands map is called "insn_operands"
83
/// Only usable by `auto-sync` archs!
84
#define map_get_op_access(MI, OpNum) \
85
4.21M
  mapping_get_op_access(MI, OpNum, (const map_insn_ops *)insn_operands, \
86
4.21M
            sizeof(insn_operands) / \
87
4.21M
              sizeof(insn_operands[0]))
88
89
///< Map for ids to their string
90
typedef struct name_map {
91
  unsigned int id;
92
  const char *name;
93
} name_map;
94
95
// map a name to its ID
96
// return 0 if not found
97
int name2id(const name_map *map, int max, const char *name);
98
99
// map ID to a name
100
// return NULL if not found
101
const char *id2name(const name_map *map, int max, const unsigned int id);
102
103
void map_add_implicit_write(MCInst *MI, uint32_t Reg);
104
void map_add_implicit_read(MCInst *MI, uint32_t Reg);
105
void map_remove_implicit_write(MCInst *MI, uint32_t Reg);
106
107
void map_implicit_reads(MCInst *MI, const insn_map *imap);
108
109
void map_implicit_writes(MCInst *MI, const insn_map *imap);
110
111
void add_group(MCInst *MI, unsigned /* arch_group */ group);
112
113
void map_groups(MCInst *MI, const insn_map *imap);
114
115
void map_cs_id(MCInst *MI, const insn_map *imap, unsigned int imap_size);
116
117
#define DECL_get_detail_op(arch, ARCH) \
118
  cs_##arch##_op *ARCH##_get_detail_op(MCInst *MI, int offset);
119
120
DECL_get_detail_op(arm, ARM);
121
DECL_get_detail_op(ppc, PPC);
122
DECL_get_detail_op(tricore, TriCore);
123
DECL_get_detail_op(aarch64, AArch64);
124
125
/// Increments the detail->arch.op_count by one.
126
#define DEFINE_inc_detail_op_count(arch, ARCH) \
127
  static inline void ARCH##_inc_op_count(MCInst *MI) \
128
3.84M
  { \
129
3.84M
    MI->flat_insn->detail->arch.op_count++; \
130
3.84M
  }
ARMMapping.c:ARM_inc_op_count
Line
Count
Source
128
3.09M
  { \
129
3.09M
    MI->flat_insn->detail->arch.op_count++; \
130
3.09M
  }
Unexecuted instantiation: ARMMapping.c:PPC_inc_op_count
Unexecuted instantiation: ARMMapping.c:TriCore_inc_op_count
Unexecuted instantiation: ARMMapping.c:AArch64_inc_op_count
AArch64Mapping.c:AArch64_inc_op_count
Line
Count
Source
128
619k
  { \
129
619k
    MI->flat_insn->detail->arch.op_count++; \
130
619k
  }
Unexecuted instantiation: AArch64Mapping.c:ARM_inc_op_count
Unexecuted instantiation: AArch64Mapping.c:PPC_inc_op_count
Unexecuted instantiation: AArch64Mapping.c:TriCore_inc_op_count
Unexecuted instantiation: MipsMapping.c:ARM_inc_op_count
Unexecuted instantiation: MipsMapping.c:PPC_inc_op_count
Unexecuted instantiation: MipsMapping.c:TriCore_inc_op_count
Unexecuted instantiation: MipsMapping.c:AArch64_inc_op_count
PPCMapping.c:PPC_inc_op_count
Line
Count
Source
128
133k
  { \
129
133k
    MI->flat_insn->detail->arch.op_count++; \
130
133k
  }
Unexecuted instantiation: PPCMapping.c:ARM_inc_op_count
Unexecuted instantiation: PPCMapping.c:TriCore_inc_op_count
Unexecuted instantiation: PPCMapping.c:AArch64_inc_op_count
Unexecuted instantiation: X86Mapping.c:ARM_inc_op_count
Unexecuted instantiation: X86Mapping.c:PPC_inc_op_count
Unexecuted instantiation: X86Mapping.c:TriCore_inc_op_count
Unexecuted instantiation: X86Mapping.c:AArch64_inc_op_count
Unexecuted instantiation: SparcMapping.c:ARM_inc_op_count
Unexecuted instantiation: SparcMapping.c:PPC_inc_op_count
Unexecuted instantiation: SparcMapping.c:TriCore_inc_op_count
Unexecuted instantiation: SparcMapping.c:AArch64_inc_op_count
Unexecuted instantiation: SystemZMapping.c:ARM_inc_op_count
Unexecuted instantiation: SystemZMapping.c:PPC_inc_op_count
Unexecuted instantiation: SystemZMapping.c:TriCore_inc_op_count
Unexecuted instantiation: SystemZMapping.c:AArch64_inc_op_count
Unexecuted instantiation: XCoreMapping.c:ARM_inc_op_count
Unexecuted instantiation: XCoreMapping.c:PPC_inc_op_count
Unexecuted instantiation: XCoreMapping.c:TriCore_inc_op_count
Unexecuted instantiation: XCoreMapping.c:AArch64_inc_op_count
Unexecuted instantiation: M68KInstPrinter.c:ARM_inc_op_count
Unexecuted instantiation: M68KInstPrinter.c:PPC_inc_op_count
Unexecuted instantiation: M68KInstPrinter.c:TriCore_inc_op_count
Unexecuted instantiation: M68KInstPrinter.c:AArch64_inc_op_count
Unexecuted instantiation: TMS320C64xMapping.c:ARM_inc_op_count
Unexecuted instantiation: TMS320C64xMapping.c:PPC_inc_op_count
Unexecuted instantiation: TMS320C64xMapping.c:TriCore_inc_op_count
Unexecuted instantiation: TMS320C64xMapping.c:AArch64_inc_op_count
Unexecuted instantiation: M680XInstPrinter.c:ARM_inc_op_count
Unexecuted instantiation: M680XInstPrinter.c:PPC_inc_op_count
Unexecuted instantiation: M680XInstPrinter.c:TriCore_inc_op_count
Unexecuted instantiation: M680XInstPrinter.c:AArch64_inc_op_count
Unexecuted instantiation: EVMMapping.c:ARM_inc_op_count
Unexecuted instantiation: EVMMapping.c:PPC_inc_op_count
Unexecuted instantiation: EVMMapping.c:TriCore_inc_op_count
Unexecuted instantiation: EVMMapping.c:AArch64_inc_op_count
Unexecuted instantiation: WASMMapping.c:ARM_inc_op_count
Unexecuted instantiation: WASMMapping.c:PPC_inc_op_count
Unexecuted instantiation: WASMMapping.c:TriCore_inc_op_count
Unexecuted instantiation: WASMMapping.c:AArch64_inc_op_count
Unexecuted instantiation: BPFMapping.c:ARM_inc_op_count
Unexecuted instantiation: BPFMapping.c:PPC_inc_op_count
Unexecuted instantiation: BPFMapping.c:TriCore_inc_op_count
Unexecuted instantiation: BPFMapping.c:AArch64_inc_op_count
Unexecuted instantiation: RISCVMapping.c:ARM_inc_op_count
Unexecuted instantiation: RISCVMapping.c:PPC_inc_op_count
Unexecuted instantiation: RISCVMapping.c:TriCore_inc_op_count
Unexecuted instantiation: RISCVMapping.c:AArch64_inc_op_count
Unexecuted instantiation: SHInstPrinter.c:ARM_inc_op_count
Unexecuted instantiation: SHInstPrinter.c:PPC_inc_op_count
Unexecuted instantiation: SHInstPrinter.c:TriCore_inc_op_count
Unexecuted instantiation: SHInstPrinter.c:AArch64_inc_op_count
Unexecuted instantiation: TriCoreMapping.c:ARM_inc_op_count
Unexecuted instantiation: TriCoreMapping.c:PPC_inc_op_count
Unexecuted instantiation: TriCoreMapping.c:TriCore_inc_op_count
Unexecuted instantiation: TriCoreMapping.c:AArch64_inc_op_count
Unexecuted instantiation: Mapping.c:ARM_inc_op_count
Unexecuted instantiation: Mapping.c:PPC_inc_op_count
Unexecuted instantiation: Mapping.c:TriCore_inc_op_count
Unexecuted instantiation: Mapping.c:AArch64_inc_op_count
Unexecuted instantiation: ARMInstPrinter.c:ARM_inc_op_count
Unexecuted instantiation: ARMInstPrinter.c:PPC_inc_op_count
Unexecuted instantiation: ARMInstPrinter.c:TriCore_inc_op_count
Unexecuted instantiation: ARMInstPrinter.c:AArch64_inc_op_count
AArch64InstPrinter.c:AArch64_inc_op_count
Line
Count
Source
128
907
  { \
129
907
    MI->flat_insn->detail->arch.op_count++; \
130
907
  }
Unexecuted instantiation: AArch64InstPrinter.c:ARM_inc_op_count
Unexecuted instantiation: AArch64InstPrinter.c:PPC_inc_op_count
Unexecuted instantiation: AArch64InstPrinter.c:TriCore_inc_op_count
Unexecuted instantiation: PPCInstPrinter.c:ARM_inc_op_count
Unexecuted instantiation: PPCInstPrinter.c:PPC_inc_op_count
Unexecuted instantiation: PPCInstPrinter.c:TriCore_inc_op_count
Unexecuted instantiation: PPCInstPrinter.c:AArch64_inc_op_count
Unexecuted instantiation: TriCoreInstPrinter.c:TriCore_inc_op_count
Unexecuted instantiation: TriCoreInstPrinter.c:ARM_inc_op_count
Unexecuted instantiation: TriCoreInstPrinter.c:PPC_inc_op_count
Unexecuted instantiation: TriCoreInstPrinter.c:AArch64_inc_op_count
131
132
/// Decrements the detail->arch.op_count by one.
133
#define DEFINE_dec_detail_op_count(arch, ARCH) \
134
  static inline void ARCH##_dec_op_count(MCInst *MI) \
135
97.5k
  { \
136
97.5k
    MI->flat_insn->detail->arch.op_count--; \
137
97.5k
  }
ARMMapping.c:ARM_dec_op_count
Line
Count
Source
135
47.8k
  { \
136
47.8k
    MI->flat_insn->detail->arch.op_count--; \
137
47.8k
  }
Unexecuted instantiation: ARMMapping.c:PPC_dec_op_count
Unexecuted instantiation: ARMMapping.c:TriCore_dec_op_count
Unexecuted instantiation: ARMMapping.c:AArch64_dec_op_count
AArch64Mapping.c:AArch64_dec_op_count
Line
Count
Source
135
49.7k
  { \
136
49.7k
    MI->flat_insn->detail->arch.op_count--; \
137
49.7k
  }
Unexecuted instantiation: AArch64Mapping.c:ARM_dec_op_count
Unexecuted instantiation: AArch64Mapping.c:PPC_dec_op_count
Unexecuted instantiation: AArch64Mapping.c:TriCore_dec_op_count
Unexecuted instantiation: MipsMapping.c:ARM_dec_op_count
Unexecuted instantiation: MipsMapping.c:PPC_dec_op_count
Unexecuted instantiation: MipsMapping.c:TriCore_dec_op_count
Unexecuted instantiation: MipsMapping.c:AArch64_dec_op_count
Unexecuted instantiation: PPCMapping.c:ARM_dec_op_count
Unexecuted instantiation: PPCMapping.c:PPC_dec_op_count
Unexecuted instantiation: PPCMapping.c:TriCore_dec_op_count
Unexecuted instantiation: PPCMapping.c:AArch64_dec_op_count
Unexecuted instantiation: X86Mapping.c:ARM_dec_op_count
Unexecuted instantiation: X86Mapping.c:PPC_dec_op_count
Unexecuted instantiation: X86Mapping.c:TriCore_dec_op_count
Unexecuted instantiation: X86Mapping.c:AArch64_dec_op_count
Unexecuted instantiation: SparcMapping.c:ARM_dec_op_count
Unexecuted instantiation: SparcMapping.c:PPC_dec_op_count
Unexecuted instantiation: SparcMapping.c:TriCore_dec_op_count
Unexecuted instantiation: SparcMapping.c:AArch64_dec_op_count
Unexecuted instantiation: SystemZMapping.c:ARM_dec_op_count
Unexecuted instantiation: SystemZMapping.c:PPC_dec_op_count
Unexecuted instantiation: SystemZMapping.c:TriCore_dec_op_count
Unexecuted instantiation: SystemZMapping.c:AArch64_dec_op_count
Unexecuted instantiation: XCoreMapping.c:ARM_dec_op_count
Unexecuted instantiation: XCoreMapping.c:PPC_dec_op_count
Unexecuted instantiation: XCoreMapping.c:TriCore_dec_op_count
Unexecuted instantiation: XCoreMapping.c:AArch64_dec_op_count
Unexecuted instantiation: M68KInstPrinter.c:ARM_dec_op_count
Unexecuted instantiation: M68KInstPrinter.c:PPC_dec_op_count
Unexecuted instantiation: M68KInstPrinter.c:TriCore_dec_op_count
Unexecuted instantiation: M68KInstPrinter.c:AArch64_dec_op_count
Unexecuted instantiation: TMS320C64xMapping.c:ARM_dec_op_count
Unexecuted instantiation: TMS320C64xMapping.c:PPC_dec_op_count
Unexecuted instantiation: TMS320C64xMapping.c:TriCore_dec_op_count
Unexecuted instantiation: TMS320C64xMapping.c:AArch64_dec_op_count
Unexecuted instantiation: M680XInstPrinter.c:ARM_dec_op_count
Unexecuted instantiation: M680XInstPrinter.c:PPC_dec_op_count
Unexecuted instantiation: M680XInstPrinter.c:TriCore_dec_op_count
Unexecuted instantiation: M680XInstPrinter.c:AArch64_dec_op_count
Unexecuted instantiation: EVMMapping.c:ARM_dec_op_count
Unexecuted instantiation: EVMMapping.c:PPC_dec_op_count
Unexecuted instantiation: EVMMapping.c:TriCore_dec_op_count
Unexecuted instantiation: EVMMapping.c:AArch64_dec_op_count
Unexecuted instantiation: WASMMapping.c:ARM_dec_op_count
Unexecuted instantiation: WASMMapping.c:PPC_dec_op_count
Unexecuted instantiation: WASMMapping.c:TriCore_dec_op_count
Unexecuted instantiation: WASMMapping.c:AArch64_dec_op_count
Unexecuted instantiation: BPFMapping.c:ARM_dec_op_count
Unexecuted instantiation: BPFMapping.c:PPC_dec_op_count
Unexecuted instantiation: BPFMapping.c:TriCore_dec_op_count
Unexecuted instantiation: BPFMapping.c:AArch64_dec_op_count
Unexecuted instantiation: RISCVMapping.c:ARM_dec_op_count
Unexecuted instantiation: RISCVMapping.c:PPC_dec_op_count
Unexecuted instantiation: RISCVMapping.c:TriCore_dec_op_count
Unexecuted instantiation: RISCVMapping.c:AArch64_dec_op_count
Unexecuted instantiation: SHInstPrinter.c:ARM_dec_op_count
Unexecuted instantiation: SHInstPrinter.c:PPC_dec_op_count
Unexecuted instantiation: SHInstPrinter.c:TriCore_dec_op_count
Unexecuted instantiation: SHInstPrinter.c:AArch64_dec_op_count
Unexecuted instantiation: TriCoreMapping.c:ARM_dec_op_count
Unexecuted instantiation: TriCoreMapping.c:PPC_dec_op_count
Unexecuted instantiation: TriCoreMapping.c:TriCore_dec_op_count
Unexecuted instantiation: TriCoreMapping.c:AArch64_dec_op_count
Unexecuted instantiation: Mapping.c:ARM_dec_op_count
Unexecuted instantiation: Mapping.c:PPC_dec_op_count
Unexecuted instantiation: Mapping.c:TriCore_dec_op_count
Unexecuted instantiation: Mapping.c:AArch64_dec_op_count
Unexecuted instantiation: ARMInstPrinter.c:ARM_dec_op_count
Unexecuted instantiation: ARMInstPrinter.c:PPC_dec_op_count
Unexecuted instantiation: ARMInstPrinter.c:TriCore_dec_op_count
Unexecuted instantiation: ARMInstPrinter.c:AArch64_dec_op_count
Unexecuted instantiation: AArch64InstPrinter.c:ARM_dec_op_count
Unexecuted instantiation: AArch64InstPrinter.c:PPC_dec_op_count
Unexecuted instantiation: AArch64InstPrinter.c:TriCore_dec_op_count
Unexecuted instantiation: AArch64InstPrinter.c:AArch64_dec_op_count
Unexecuted instantiation: PPCInstPrinter.c:ARM_dec_op_count
Unexecuted instantiation: PPCInstPrinter.c:PPC_dec_op_count
Unexecuted instantiation: PPCInstPrinter.c:TriCore_dec_op_count
Unexecuted instantiation: PPCInstPrinter.c:AArch64_dec_op_count
Unexecuted instantiation: TriCoreInstPrinter.c:ARM_dec_op_count
Unexecuted instantiation: TriCoreInstPrinter.c:PPC_dec_op_count
Unexecuted instantiation: TriCoreInstPrinter.c:TriCore_dec_op_count
Unexecuted instantiation: TriCoreInstPrinter.c:AArch64_dec_op_count
138
139
DEFINE_inc_detail_op_count(arm, ARM);
140
DEFINE_dec_detail_op_count(arm, ARM);
141
DEFINE_inc_detail_op_count(ppc, PPC);
142
DEFINE_dec_detail_op_count(ppc, PPC);
143
DEFINE_inc_detail_op_count(tricore, TriCore);
144
DEFINE_dec_detail_op_count(tricore, TriCore);
145
DEFINE_inc_detail_op_count(aarch64, AArch64);
146
DEFINE_dec_detail_op_count(aarch64, AArch64);
147
148
/// Returns true if a memory operand is currently edited.
149
static inline bool doing_mem(const MCInst *MI)
150
2.42M
{
151
2.42M
  return MI->csh->doing_mem;
152
2.42M
}
ARMMapping.c:doing_mem
Line
Count
Source
150
2.15M
{
151
2.15M
  return MI->csh->doing_mem;
152
2.15M
}
Unexecuted instantiation: AArch64Mapping.c:doing_mem
Unexecuted instantiation: MipsMapping.c:doing_mem
PPCMapping.c:doing_mem
Line
Count
Source
150
270k
{
151
270k
  return MI->csh->doing_mem;
152
270k
}
Unexecuted instantiation: X86Mapping.c:doing_mem
Unexecuted instantiation: SparcMapping.c:doing_mem
Unexecuted instantiation: SystemZMapping.c:doing_mem
Unexecuted instantiation: XCoreMapping.c:doing_mem
Unexecuted instantiation: M68KInstPrinter.c:doing_mem
Unexecuted instantiation: TMS320C64xMapping.c:doing_mem
Unexecuted instantiation: M680XInstPrinter.c:doing_mem
Unexecuted instantiation: EVMMapping.c:doing_mem
Unexecuted instantiation: WASMMapping.c:doing_mem
Unexecuted instantiation: BPFMapping.c:doing_mem
Unexecuted instantiation: RISCVMapping.c:doing_mem
Unexecuted instantiation: SHInstPrinter.c:doing_mem
Unexecuted instantiation: TriCoreMapping.c:doing_mem
Unexecuted instantiation: Mapping.c:doing_mem
Unexecuted instantiation: ARMInstPrinter.c:doing_mem
Unexecuted instantiation: AArch64InstPrinter.c:doing_mem
Unexecuted instantiation: PPCInstPrinter.c:doing_mem
Unexecuted instantiation: TriCoreInstPrinter.c:doing_mem
153
154
/// Sets the doing_mem flag to @status.
155
static inline void set_doing_mem(const MCInst *MI, bool status)
156
924k
{
157
924k
  MI->csh->doing_mem = status;
158
924k
}
ARMMapping.c:set_doing_mem
Line
Count
Source
156
677k
{
157
677k
  MI->csh->doing_mem = status;
158
677k
}
AArch64Mapping.c:set_doing_mem
Line
Count
Source
156
215k
{
157
215k
  MI->csh->doing_mem = status;
158
215k
}
Unexecuted instantiation: MipsMapping.c:set_doing_mem
PPCMapping.c:set_doing_mem
Line
Count
Source
156
31.5k
{
157
31.5k
  MI->csh->doing_mem = status;
158
31.5k
}
Unexecuted instantiation: X86Mapping.c:set_doing_mem
Unexecuted instantiation: SparcMapping.c:set_doing_mem
Unexecuted instantiation: SystemZMapping.c:set_doing_mem
Unexecuted instantiation: XCoreMapping.c:set_doing_mem
Unexecuted instantiation: M68KInstPrinter.c:set_doing_mem
Unexecuted instantiation: TMS320C64xMapping.c:set_doing_mem
Unexecuted instantiation: M680XInstPrinter.c:set_doing_mem
Unexecuted instantiation: EVMMapping.c:set_doing_mem
Unexecuted instantiation: WASMMapping.c:set_doing_mem
Unexecuted instantiation: BPFMapping.c:set_doing_mem
Unexecuted instantiation: RISCVMapping.c:set_doing_mem
Unexecuted instantiation: SHInstPrinter.c:set_doing_mem
Unexecuted instantiation: TriCoreMapping.c:set_doing_mem
Unexecuted instantiation: Mapping.c:set_doing_mem
Unexecuted instantiation: ARMInstPrinter.c:set_doing_mem
Unexecuted instantiation: AArch64InstPrinter.c:set_doing_mem
Unexecuted instantiation: PPCInstPrinter.c:set_doing_mem
Unexecuted instantiation: TriCoreInstPrinter.c:set_doing_mem
159
160
/// Returns detail->arch
161
#define DEFINE_get_arch_detail(arch, ARCH) \
162
  static inline cs_##arch *ARCH##_get_detail(const MCInst *MI) \
163
63.0M
  { \
164
63.0M
    assert(MI && MI->flat_insn && MI->flat_insn->detail); \
165
63.0M
    return &MI->flat_insn->detail->arch; \
166
63.0M
  }
ARMMapping.c:ARM_get_detail
Line
Count
Source
163
56.7M
  { \
164
56.7M
    assert(MI && MI->flat_insn && MI->flat_insn->detail); \
165
56.7M
    return &MI->flat_insn->detail->arch; \
166
56.7M
  }
Unexecuted instantiation: ARMMapping.c:PPC_get_detail
Unexecuted instantiation: ARMMapping.c:TriCore_get_detail
Unexecuted instantiation: ARMMapping.c:AArch64_get_detail
AArch64Mapping.c:AArch64_get_detail
Line
Count
Source
163
5.79M
  { \
164
5.79M
    assert(MI && MI->flat_insn && MI->flat_insn->detail); \
165
5.79M
    return &MI->flat_insn->detail->arch; \
166
5.79M
  }
Unexecuted instantiation: AArch64Mapping.c:ARM_get_detail
Unexecuted instantiation: AArch64Mapping.c:PPC_get_detail
Unexecuted instantiation: AArch64Mapping.c:TriCore_get_detail
Unexecuted instantiation: MipsMapping.c:ARM_get_detail
Unexecuted instantiation: MipsMapping.c:PPC_get_detail
Unexecuted instantiation: MipsMapping.c:TriCore_get_detail
Unexecuted instantiation: MipsMapping.c:AArch64_get_detail
PPCMapping.c:PPC_get_detail
Line
Count
Source
163
491k
  { \
164
491k
    assert(MI && MI->flat_insn && MI->flat_insn->detail); \
165
491k
    return &MI->flat_insn->detail->arch; \
166
491k
  }
Unexecuted instantiation: PPCMapping.c:ARM_get_detail
Unexecuted instantiation: PPCMapping.c:TriCore_get_detail
Unexecuted instantiation: PPCMapping.c:AArch64_get_detail
Unexecuted instantiation: X86Mapping.c:ARM_get_detail
Unexecuted instantiation: X86Mapping.c:PPC_get_detail
Unexecuted instantiation: X86Mapping.c:TriCore_get_detail
Unexecuted instantiation: X86Mapping.c:AArch64_get_detail
Unexecuted instantiation: SparcMapping.c:ARM_get_detail
Unexecuted instantiation: SparcMapping.c:PPC_get_detail
Unexecuted instantiation: SparcMapping.c:TriCore_get_detail
Unexecuted instantiation: SparcMapping.c:AArch64_get_detail
Unexecuted instantiation: SystemZMapping.c:ARM_get_detail
Unexecuted instantiation: SystemZMapping.c:PPC_get_detail
Unexecuted instantiation: SystemZMapping.c:TriCore_get_detail
Unexecuted instantiation: SystemZMapping.c:AArch64_get_detail
Unexecuted instantiation: XCoreMapping.c:ARM_get_detail
Unexecuted instantiation: XCoreMapping.c:PPC_get_detail
Unexecuted instantiation: XCoreMapping.c:TriCore_get_detail
Unexecuted instantiation: XCoreMapping.c:AArch64_get_detail
Unexecuted instantiation: M68KInstPrinter.c:ARM_get_detail
Unexecuted instantiation: M68KInstPrinter.c:PPC_get_detail
Unexecuted instantiation: M68KInstPrinter.c:TriCore_get_detail
Unexecuted instantiation: M68KInstPrinter.c:AArch64_get_detail
Unexecuted instantiation: TMS320C64xMapping.c:ARM_get_detail
Unexecuted instantiation: TMS320C64xMapping.c:PPC_get_detail
Unexecuted instantiation: TMS320C64xMapping.c:TriCore_get_detail
Unexecuted instantiation: TMS320C64xMapping.c:AArch64_get_detail
Unexecuted instantiation: M680XInstPrinter.c:ARM_get_detail
Unexecuted instantiation: M680XInstPrinter.c:PPC_get_detail
Unexecuted instantiation: M680XInstPrinter.c:TriCore_get_detail
Unexecuted instantiation: M680XInstPrinter.c:AArch64_get_detail
Unexecuted instantiation: EVMMapping.c:ARM_get_detail
Unexecuted instantiation: EVMMapping.c:PPC_get_detail
Unexecuted instantiation: EVMMapping.c:TriCore_get_detail
Unexecuted instantiation: EVMMapping.c:AArch64_get_detail
Unexecuted instantiation: WASMMapping.c:ARM_get_detail
Unexecuted instantiation: WASMMapping.c:PPC_get_detail
Unexecuted instantiation: WASMMapping.c:TriCore_get_detail
Unexecuted instantiation: WASMMapping.c:AArch64_get_detail
Unexecuted instantiation: BPFMapping.c:ARM_get_detail
Unexecuted instantiation: BPFMapping.c:PPC_get_detail
Unexecuted instantiation: BPFMapping.c:TriCore_get_detail
Unexecuted instantiation: BPFMapping.c:AArch64_get_detail
Unexecuted instantiation: RISCVMapping.c:ARM_get_detail
Unexecuted instantiation: RISCVMapping.c:PPC_get_detail
Unexecuted instantiation: RISCVMapping.c:TriCore_get_detail
Unexecuted instantiation: RISCVMapping.c:AArch64_get_detail
Unexecuted instantiation: SHInstPrinter.c:ARM_get_detail
Unexecuted instantiation: SHInstPrinter.c:PPC_get_detail
Unexecuted instantiation: SHInstPrinter.c:TriCore_get_detail
Unexecuted instantiation: SHInstPrinter.c:AArch64_get_detail
Unexecuted instantiation: TriCoreMapping.c:ARM_get_detail
Unexecuted instantiation: TriCoreMapping.c:PPC_get_detail
Unexecuted instantiation: TriCoreMapping.c:TriCore_get_detail
Unexecuted instantiation: TriCoreMapping.c:AArch64_get_detail
Unexecuted instantiation: Mapping.c:ARM_get_detail
Unexecuted instantiation: Mapping.c:PPC_get_detail
Unexecuted instantiation: Mapping.c:TriCore_get_detail
Unexecuted instantiation: Mapping.c:AArch64_get_detail
Unexecuted instantiation: ARMInstPrinter.c:ARM_get_detail
Unexecuted instantiation: ARMInstPrinter.c:PPC_get_detail
Unexecuted instantiation: ARMInstPrinter.c:TriCore_get_detail
Unexecuted instantiation: ARMInstPrinter.c:AArch64_get_detail
Unexecuted instantiation: AArch64InstPrinter.c:ARM_get_detail
Unexecuted instantiation: AArch64InstPrinter.c:PPC_get_detail
Unexecuted instantiation: AArch64InstPrinter.c:TriCore_get_detail
Unexecuted instantiation: AArch64InstPrinter.c:AArch64_get_detail
Unexecuted instantiation: PPCInstPrinter.c:ARM_get_detail
Unexecuted instantiation: PPCInstPrinter.c:PPC_get_detail
Unexecuted instantiation: PPCInstPrinter.c:TriCore_get_detail
Unexecuted instantiation: PPCInstPrinter.c:AArch64_get_detail
Unexecuted instantiation: TriCoreInstPrinter.c:TriCore_get_detail
Unexecuted instantiation: TriCoreInstPrinter.c:ARM_get_detail
Unexecuted instantiation: TriCoreInstPrinter.c:PPC_get_detail
Unexecuted instantiation: TriCoreInstPrinter.c:AArch64_get_detail
167
168
DEFINE_get_arch_detail(arm, ARM);
169
DEFINE_get_arch_detail(ppc, PPC);
170
DEFINE_get_arch_detail(tricore, TriCore);
171
DEFINE_get_arch_detail(aarch64, AArch64);
172
173
static inline bool detail_is_set(const MCInst *MI)
174
25.1M
{
175
25.1M
  assert(MI && MI->flat_insn);
176
25.1M
  return MI->flat_insn->detail != NULL && MI->csh->detail_opt & CS_OPT_ON;
177
25.1M
}
ARMMapping.c:detail_is_set
Line
Count
Source
174
18.1M
{
175
18.1M
  assert(MI && MI->flat_insn);
176
18.1M
  return MI->flat_insn->detail != NULL && MI->csh->detail_opt & CS_OPT_ON;
177
18.1M
}
AArch64Mapping.c:detail_is_set
Line
Count
Source
174
3.40M
{
175
3.40M
  assert(MI && MI->flat_insn);
176
3.40M
  return MI->flat_insn->detail != NULL && MI->csh->detail_opt & CS_OPT_ON;
177
3.40M
}
Unexecuted instantiation: MipsMapping.c:detail_is_set
PPCMapping.c:detail_is_set
Line
Count
Source
174
706k
{
175
706k
  assert(MI && MI->flat_insn);
176
706k
  return MI->flat_insn->detail != NULL && MI->csh->detail_opt & CS_OPT_ON;
177
706k
}
Unexecuted instantiation: X86Mapping.c:detail_is_set
Unexecuted instantiation: SparcMapping.c:detail_is_set
Unexecuted instantiation: SystemZMapping.c:detail_is_set
Unexecuted instantiation: XCoreMapping.c:detail_is_set
Unexecuted instantiation: M68KInstPrinter.c:detail_is_set
Unexecuted instantiation: TMS320C64xMapping.c:detail_is_set
Unexecuted instantiation: M680XInstPrinter.c:detail_is_set
Unexecuted instantiation: EVMMapping.c:detail_is_set
Unexecuted instantiation: WASMMapping.c:detail_is_set
Unexecuted instantiation: BPFMapping.c:detail_is_set
Unexecuted instantiation: RISCVMapping.c:detail_is_set
Unexecuted instantiation: SHInstPrinter.c:detail_is_set
Unexecuted instantiation: TriCoreMapping.c:detail_is_set
Mapping.c:detail_is_set
Line
Count
Source
174
2.80M
{
175
2.80M
  assert(MI && MI->flat_insn);
176
2.80M
  return MI->flat_insn->detail != NULL && MI->csh->detail_opt & CS_OPT_ON;
177
2.80M
}
Unexecuted instantiation: ARMInstPrinter.c:detail_is_set
AArch64InstPrinter.c:detail_is_set
Line
Count
Source
174
8.38k
{
175
8.38k
  assert(MI && MI->flat_insn);
176
8.38k
  return MI->flat_insn->detail != NULL && MI->csh->detail_opt & CS_OPT_ON;
177
8.38k
}
Unexecuted instantiation: PPCInstPrinter.c:detail_is_set
Unexecuted instantiation: TriCoreInstPrinter.c:detail_is_set
178
179
static inline cs_detail *get_detail(const MCInst *MI)
180
2.89M
{
181
2.89M
  assert(MI && MI->flat_insn);
182
2.89M
  return MI->flat_insn->detail;
183
2.89M
}
ARMMapping.c:get_detail
Line
Count
Source
180
2.37M
{
181
2.37M
  assert(MI && MI->flat_insn);
182
2.37M
  return MI->flat_insn->detail;
183
2.37M
}
AArch64Mapping.c:get_detail
Line
Count
Source
180
415k
{
181
415k
  assert(MI && MI->flat_insn);
182
415k
  return MI->flat_insn->detail;
183
415k
}
Unexecuted instantiation: MipsMapping.c:get_detail
PPCMapping.c:get_detail
Line
Count
Source
180
104k
{
181
104k
  assert(MI && MI->flat_insn);
182
104k
  return MI->flat_insn->detail;
183
104k
}
Unexecuted instantiation: X86Mapping.c:get_detail
Unexecuted instantiation: SparcMapping.c:get_detail
Unexecuted instantiation: SystemZMapping.c:get_detail
Unexecuted instantiation: XCoreMapping.c:get_detail
Unexecuted instantiation: M68KInstPrinter.c:get_detail
Unexecuted instantiation: TMS320C64xMapping.c:get_detail
Unexecuted instantiation: M680XInstPrinter.c:get_detail
Unexecuted instantiation: EVMMapping.c:get_detail
Unexecuted instantiation: WASMMapping.c:get_detail
Unexecuted instantiation: BPFMapping.c:get_detail
Unexecuted instantiation: RISCVMapping.c:get_detail
Unexecuted instantiation: SHInstPrinter.c:get_detail
Unexecuted instantiation: TriCoreMapping.c:get_detail
Unexecuted instantiation: Mapping.c:get_detail
Unexecuted instantiation: ARMInstPrinter.c:get_detail
Unexecuted instantiation: AArch64InstPrinter.c:get_detail
Unexecuted instantiation: PPCInstPrinter.c:get_detail
Unexecuted instantiation: TriCoreInstPrinter.c:get_detail
184
185
/// Returns if the given instruction is an alias instruction.
186
#define RETURN_IF_INSN_IS_ALIAS(MI) \
187
do { \
188
  if (MI->isAliasInstr) \
189
    return; \
190
} while(0)
191
192
void map_set_fill_detail_ops(MCInst *MI, bool Val);
193
194
4.96M
static inline bool map_fill_detail_ops(MCInst *MI) {
195
4.96M
  assert(MI);
196
4.96M
  return MI->fillDetailOps;
197
4.96M
}
ARMMapping.c:map_fill_detail_ops
Line
Count
Source
194
4.20M
static inline bool map_fill_detail_ops(MCInst *MI) {
195
4.20M
  assert(MI);
196
4.20M
  return MI->fillDetailOps;
197
4.20M
}
AArch64Mapping.c:map_fill_detail_ops
Line
Count
Source
194
601k
static inline bool map_fill_detail_ops(MCInst *MI) {
195
601k
  assert(MI);
196
601k
  return MI->fillDetailOps;
197
601k
}
Unexecuted instantiation: MipsMapping.c:map_fill_detail_ops
PPCMapping.c:map_fill_detail_ops
Line
Count
Source
194
162k
static inline bool map_fill_detail_ops(MCInst *MI) {
195
162k
  assert(MI);
196
162k
  return MI->fillDetailOps;
197
162k
}
Unexecuted instantiation: X86Mapping.c:map_fill_detail_ops
Unexecuted instantiation: SparcMapping.c:map_fill_detail_ops
Unexecuted instantiation: SystemZMapping.c:map_fill_detail_ops
Unexecuted instantiation: XCoreMapping.c:map_fill_detail_ops
Unexecuted instantiation: M68KInstPrinter.c:map_fill_detail_ops
Unexecuted instantiation: TMS320C64xMapping.c:map_fill_detail_ops
Unexecuted instantiation: M680XInstPrinter.c:map_fill_detail_ops
Unexecuted instantiation: EVMMapping.c:map_fill_detail_ops
Unexecuted instantiation: WASMMapping.c:map_fill_detail_ops
Unexecuted instantiation: BPFMapping.c:map_fill_detail_ops
Unexecuted instantiation: RISCVMapping.c:map_fill_detail_ops
Unexecuted instantiation: SHInstPrinter.c:map_fill_detail_ops
Unexecuted instantiation: TriCoreMapping.c:map_fill_detail_ops
Unexecuted instantiation: Mapping.c:map_fill_detail_ops
Unexecuted instantiation: ARMInstPrinter.c:map_fill_detail_ops
Unexecuted instantiation: AArch64InstPrinter.c:map_fill_detail_ops
Unexecuted instantiation: PPCInstPrinter.c:map_fill_detail_ops
Unexecuted instantiation: TriCoreInstPrinter.c:map_fill_detail_ops
198
199
void map_set_is_alias_insn(MCInst *MI, bool Val, uint64_t Alias);
200
201
bool map_use_alias_details(const MCInst *MI);
202
203
void map_set_alias_id(MCInst *MI, const SStream *O, const name_map *alias_mnem_id_map, int map_size);
204
205
#endif // CS_MAPPING_H