/src/capstonev5/arch/RISCV/RISCVModule.c
Line | Count | Source |
1 | | /* Capstone Disassembly Engine */ |
2 | | /* RISC-V Backend By Rodrigo Cortes Porto <porto703@gmail.com> & |
3 | | Shawn Chang <citypw@gmail.com>, HardenedLinux@2018 */ |
4 | | |
5 | | #ifdef CAPSTONE_HAS_RISCV |
6 | | |
7 | | #include "../../utils.h" |
8 | | #include "../../MCRegisterInfo.h" |
9 | | #include "RISCVDisassembler.h" |
10 | | #include "RISCVInstPrinter.h" |
11 | | #include "RISCVMapping.h" |
12 | | #include "RISCVModule.h" |
13 | | |
14 | | cs_err RISCV_global_init(cs_struct * ud) |
15 | 1.77k | { |
16 | 1.77k | MCRegisterInfo *mri; |
17 | 1.77k | mri = cs_mem_malloc(sizeof(*mri)); |
18 | 1.77k | if (mri == NULL) { |
19 | 0 | return CS_ERR_MEM; |
20 | 0 | } |
21 | | |
22 | 1.77k | RISCV_init(mri); |
23 | 1.77k | ud->printer = RISCV_printInst; |
24 | 1.77k | ud->printer_info = mri; |
25 | 1.77k | ud->getinsn_info = mri; |
26 | 1.77k | ud->disasm = RISCV_getInstruction; |
27 | 1.77k | ud->post_printer = NULL; |
28 | | |
29 | 1.77k | ud->reg_name = RISCV_reg_name; |
30 | 1.77k | ud->insn_id = RISCV_get_insn_id; |
31 | 1.77k | ud->insn_name = RISCV_insn_name; |
32 | 1.77k | ud->group_name = RISCV_group_name; |
33 | | |
34 | 1.77k | return CS_ERR_OK; |
35 | 1.77k | } |
36 | | |
37 | | cs_err RISCV_option(cs_struct * handle, cs_opt_type type, size_t value) |
38 | 196 | { |
39 | 196 | if (type == CS_OPT_SYNTAX) |
40 | 196 | handle->syntax = (int)value; |
41 | | |
42 | 196 | return CS_ERR_OK; |
43 | 196 | } |
44 | | |
45 | | #endif |