/src/capstonenext/arch/RISCV/RISCVModule.c
Line | Count | Source (jump to first uncovered line) |
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.94k | { |
16 | 3.94k | MCRegisterInfo *mri; |
17 | 3.94k | mri = cs_mem_malloc(sizeof(*mri)); |
18 | | |
19 | 3.94k | RISCV_init(mri); |
20 | 3.94k | ud->printer = RISCV_printInst; |
21 | 3.94k | ud->printer_info = mri; |
22 | 3.94k | ud->getinsn_info = mri; |
23 | 3.94k | ud->disasm = RISCV_getInstruction; |
24 | 3.94k | ud->post_printer = NULL; |
25 | | |
26 | 3.94k | ud->reg_name = RISCV_reg_name; |
27 | 3.94k | ud->insn_id = RISCV_get_insn_id; |
28 | 3.94k | ud->insn_name = RISCV_insn_name; |
29 | 3.94k | ud->group_name = RISCV_group_name; |
30 | | |
31 | 3.94k | return CS_ERR_OK; |
32 | 3.94k | } |
33 | | |
34 | | cs_err RISCV_option(cs_struct * handle, cs_opt_type type, size_t value) |
35 | 384 | { |
36 | 384 | if (type == CS_OPT_SYNTAX) { |
37 | 384 | handle->syntax = (int)value; |
38 | 384 | } else if (type == CS_OPT_MODE) { |
39 | 0 | handle->mode = (cs_mode)value; |
40 | 0 | } |
41 | | |
42 | 384 | return CS_ERR_OK; |
43 | 384 | } |
44 | | |
45 | | #endif |