/src/capstonenext/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 | 3.60k | { |
16 | 3.60k | MCRegisterInfo *mri; |
17 | 3.60k | mri = cs_mem_malloc(sizeof(*mri)); |
18 | | |
19 | 3.60k | RISCV_init(mri); |
20 | 3.60k | ud->printer = RISCV_printInst; |
21 | 3.60k | ud->printer_info = mri; |
22 | 3.60k | ud->getinsn_info = mri; |
23 | 3.60k | ud->disasm = RISCV_getInstruction; |
24 | 3.60k | ud->post_printer = NULL; |
25 | | |
26 | 3.60k | ud->reg_name = RISCV_reg_name; |
27 | 3.60k | ud->insn_id = RISCV_get_insn_id; |
28 | 3.60k | ud->insn_name = RISCV_insn_name; |
29 | 3.60k | ud->group_name = RISCV_group_name; |
30 | | |
31 | 3.60k | return CS_ERR_OK; |
32 | 3.60k | } |
33 | | |
34 | | cs_err RISCV_option(cs_struct * handle, cs_opt_type type, size_t value) |
35 | 619 | { |
36 | 619 | if (type == CS_OPT_SYNTAX) |
37 | 619 | handle->syntax = (int)value; |
38 | | |
39 | 619 | return CS_ERR_OK; |
40 | 619 | } |
41 | | |
42 | | #endif |