| 1 | /* Capstone Disassembly Engine */cxx . . $ `<file>/arch/ARM/ARMModule.c`/ |
| 2 | /* By Dang Hoang Vu <[email protected]> 2013 */ |
| 3 | |
| 4 | #ifdef CAPSTONE_HAS_ARMcxx . . $ `<built-in>:412:9`! |
| 5 | |
| 6 | #include "../../cs_priv.h"cxx . . $ `<file>/cs_priv.h`/ |
| 7 | #include "../../MCRegisterInfo.h"cxx . . $ `<file>/MCRegisterInfo.h`/ |
| 8 | #include "ARMDisassembler.h"cxx . . $ `<file>/arch/ARM/ARMDisassembler.h`/ |
| 9 | #include "ARMInstPrinter.h"cxx . . $ `<file>/arch/ARM/ARMInstPrinter.h`/ |
| 10 | #include "ARMMapping.h"cxx . . $ `<file>/arch/ARM/ARMMapping.h`/ |
| 11 | #include "ARMModule.h"cxx . . $ `<file>/arch/ARM/ARMModule.h`/ |
| 12 | |
| 13 | cs_errcxx . . $ cs_err# ARM_global_initcxx . . $ ARM_global_init(2c23641276a36c6e).(cs_structcxx . . $ cs_struct# *ud) |
| 14 | { |
| 15 | MCRegisterInfocxx . . $ MCRegisterInfo# *mri; |
| 16 | mri = cs_mem_malloccxx . . $ cs_mem_malloc.(sizeof(*mri)); |
| 17 | |
| 18 | ARM_initcxx . . $ ARM_init(c2e0c34190506c3d).(mri); |
| 19 | ARM_getRegNamecxx . . $ ARM_getRegName(5703dc972543902).(ud, 0); // use default get_regname |
| 20 | |
| 21 | ud->printercxx . . $ cs_struct#printer. = ARM_printInstcxx . . $ ARM_printInst(6238f66e5ea10f57).; |
| 22 | ud->printer_infocxx . . $ cs_struct#printer_info. = mri; |
| 23 | ud->reg_namecxx . . $ cs_struct#reg_name. = ARM_reg_namecxx . . $ ARM_reg_name(efd1348d9ae5172e).; |
| 24 | ud->insn_idcxx . . $ cs_struct#insn_id. = ARM_get_insn_idcxx . . $ ARM_get_insn_id(b32a94ba649bfb5a).; |
| 25 | ud->insn_namecxx . . $ cs_struct#insn_name. = ARM_insn_namecxx . . $ ARM_insn_name(efd1348d9ae5172e).; |
| 26 | ud->group_namecxx . . $ cs_struct#group_name. = ARM_group_namecxx . . $ ARM_group_name(efd1348d9ae5172e).; |
| 27 | ud->post_printercxx . . $ cs_struct#post_printer. = ARM_post_printercxx . . $ ARM_post_printer(1e4eab0813f35322).; |
| 28 | #ifndef CAPSTONE_DIET |
| 29 | ud->reg_accesscxx . . $ cs_struct#reg_access. = ARM_reg_accesscxx . . $ ARM_reg_access(a4e53139cd2f126c).; |
| 30 | #endif |
| 31 | |
| 32 | if (ud->modecxx . . $ cs_struct#mode. & CS_MODE_THUMBcxx . . $ CS_MODE_THUMB.) |
| 33 | ud->disasmcxx . . $ cs_struct#disasm. = Thumb_getInstructioncxx . . $ Thumb_getInstruction(fe94ce91eeab61e9).; |
| 34 | else |
| 35 | ud->disasmcxx . . $ cs_struct#disasm. = ARM_getInstructioncxx . . $ ARM_getInstruction(fe94ce91eeab61e9).; |
| 36 | |
| 37 | return CS_ERR_OKcxx . . $ CS_ERR_OK.; |
| 38 | } |
| 39 | |
| 40 | cs_errcxx . . $ cs_err# ARM_optioncxx . . $ ARM_option(34dd9365584c51ad).(cs_structcxx . . $ cs_struct# *handle, cs_opt_typecxx . . $ cs_opt_type# type, size_tcxx . . $ size_t# value) |
| 41 | { |
| 42 | switch(type) { |
| 43 | case CS_OPT_MODEcxx . . $ CS_OPT_MODE.: |
| 44 | if (value & CS_MODE_THUMBcxx . . $ CS_MODE_THUMB.) |
| 45 | handle->disasmcxx . . $ cs_struct#disasm. = Thumb_getInstructioncxx . . $ Thumb_getInstruction(fe94ce91eeab61e9).; |
| 46 | else |
| 47 | handle->disasmcxx . . $ cs_struct#disasm. = ARM_getInstructioncxx . . $ ARM_getInstruction(fe94ce91eeab61e9).; |
| 48 | |
| 49 | handle->modecxx . . $ cs_struct#mode. = (cs_modecxx . . $ cs_mode#)value; |
| 50 | |
| 51 | break; |
| 52 | case CS_OPT_SYNTAXcxx . . $ CS_OPT_SYNTAX.: |
| 53 | ARM_getRegNamecxx . . $ ARM_getRegName(5703dc972543902).(handle, (int)value); |
| 54 | handle->syntaxcxx . . $ cs_struct#syntax. = (int)value; |
| 55 | break; |
| 56 | default: |
| 57 | break; |
| 58 | } |
| 59 | |
| 60 | return CS_ERR_OKcxx . . $ CS_ERR_OK.; |
| 61 | } |
| 62 | |
| 63 | #endif |