/src/capstonenext/arch/Mips/MipsMapping.h
Line  | Count  | Source  | 
1  |  | /* Capstone Disassembly Engine */  | 
2  |  | /* By Giovanni Dante Grazioli, deroad <wargio@libero.it>, 2024 */  | 
3  |  |  | 
4  |  | #ifndef CS_MIPS_MAPPING_H  | 
5  |  | #define CS_MIPS_MAPPING_H  | 
6  |  |  | 
7  |  | #include "../../include/capstone/capstone.h"  | 
8  |  | #include "../../utils.h"  | 
9  |  | #include "../../Mapping.h"  | 
10  |  |  | 
11  |  | typedef enum { | 
12  |  | #include "MipsGenCSOpGroup.inc"  | 
13  |  | } mips_op_group;  | 
14  |  |  | 
15  |  | void Mips_init_mri(MCRegisterInfo *MRI);  | 
16  |  |  | 
17  |  | // return name of register in friendly string  | 
18  |  | const char *Mips_reg_name(csh handle, unsigned int reg);  | 
19  |  |  | 
20  |  | void Mips_printer(MCInst *MI, SStream *O, void * /* MCRegisterInfo* */ info);  | 
21  |  |  | 
22  |  | // given internal insn id, return public instruction ID  | 
23  |  | void Mips_get_insn_id(cs_struct *h, cs_insn *insn, unsigned int id);  | 
24  |  |  | 
25  |  | const char *Mips_insn_name(csh handle, unsigned int id);  | 
26  |  |  | 
27  |  | const char *Mips_group_name(csh handle, unsigned int id);  | 
28  |  |  | 
29  |  | bool Mips_getInstruction(csh handle, const uint8_t *code, size_t code_len,  | 
30  |  |        MCInst *instr, uint16_t *size, uint64_t address,  | 
31  |  |        void *info);  | 
32  |  |  | 
33  |  | void Mips_reg_access(const cs_insn *insn, cs_regs regs_read,  | 
34  |  |          uint8_t *regs_read_count, cs_regs regs_write,  | 
35  |  |          uint8_t *regs_write_count);  | 
36  |  |  | 
37  |  | // cs_detail related functions  | 
38  |  | void Mips_init_cs_detail(MCInst *MI);  | 
39  |  |  | 
40  |  | void Mips_set_mem_access(MCInst *MI, bool status);  | 
41  |  |  | 
42  |  | void Mips_add_cs_detail(MCInst *MI, mips_op_group op_group, va_list args);  | 
43  |  |  | 
44  |  | static inline void add_cs_detail(MCInst *MI, mips_op_group op_group, ...)  | 
45  | 261k  | { | 
46  | 261k  |   if (!detail_is_set(MI))  | 
47  | 0  |     return;  | 
48  | 261k  |   va_list args;  | 
49  | 261k  |   va_start(args, op_group);  | 
50  | 261k  |   Mips_add_cs_detail(MI, op_group, args);  | 
51  | 261k  |   va_end(args);  | 
52  | 261k  | } Unexecuted instantiation: MipsModule.c:add_cs_detail Unexecuted instantiation: MipsMapping.c:add_cs_detail MipsInstPrinter.c:add_cs_detail Line  | Count  | Source  |  45  | 261k  | { |  46  | 261k  |   if (!detail_is_set(MI))  |  47  | 0  |     return;  |  48  | 261k  |   va_list args;  |  49  | 261k  |   va_start(args, op_group);  |  50  | 261k  |   Mips_add_cs_detail(MI, op_group, args);  |  51  |  |   va_end(args);  |  52  | 261k  | }  |  
  | 
53  |  |  | 
54  |  | static inline void set_mem_access(MCInst *MI, bool status)  | 
55  | 48.1k  | { | 
56  | 48.1k  |   if (!detail_is_set(MI))  | 
57  | 0  |     return;  | 
58  | 48.1k  |   Mips_set_mem_access(MI, status);  | 
59  | 48.1k  | } Unexecuted instantiation: MipsModule.c:set_mem_access Unexecuted instantiation: MipsMapping.c:set_mem_access MipsInstPrinter.c:set_mem_access Line  | Count  | Source  |  55  | 48.1k  | { |  56  | 48.1k  |   if (!detail_is_set(MI))  |  57  | 0  |     return;  |  58  | 48.1k  |   Mips_set_mem_access(MI, status);  |  59  | 48.1k  | }  |  
  | 
60  |  |  | 
61  |  | #endif // CS_MIPS_MAPPING_H  |