1 /* Capstone Disassembly Engine */ 2 /* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2014 */ 3 4 #ifdef CAPSTONE_HAS_SYSZ 5 6 #include "../../utils.h" 7 #include "../../MCRegisterInfo.h" 8 #include "SystemZDisassembler.h" 9 #include "SystemZInstPrinter.h" 10 #include "SystemZMapping.h" 11 init(cs_struct * ud)12static cs_err init(cs_struct *ud) 13 { 14 MCRegisterInfo *mri; 15 16 mri = cs_mem_malloc(sizeof(*mri)); 17 18 SystemZ_init(mri); 19 ud->printer = SystemZ_printInst; 20 ud->printer_info = mri; 21 ud->getinsn_info = mri; 22 ud->disasm = SystemZ_getInstruction; 23 ud->post_printer = SystemZ_post_printer; 24 25 ud->reg_name = SystemZ_reg_name; 26 ud->insn_id = SystemZ_get_insn_id; 27 ud->insn_name = SystemZ_insn_name; 28 ud->group_name = SystemZ_group_name; 29 30 return CS_ERR_OK; 31 } 32 option(cs_struct * handle,cs_opt_type type,size_t value)33static cs_err option(cs_struct *handle, cs_opt_type type, size_t value) 34 { 35 if (type == CS_OPT_SYNTAX) 36 handle->syntax = (int) value; 37 38 return CS_ERR_OK; 39 } 40 destroy(cs_struct * handle)41static void destroy(cs_struct *handle) 42 { 43 } 44 SystemZ_enable(void)45void SystemZ_enable(void) 46 { 47 arch_init[CS_ARCH_SYSZ] = init; 48 arch_option[CS_ARCH_SYSZ] = option; 49 arch_destroy[CS_ARCH_SYSZ] = destroy; 50 51 // support this arch 52 all_arch |= (1 << CS_ARCH_SYSZ); 53 } 54 55 #endif 56