• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Capstone Disassembly Engine */
2 /* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2015 */
3 
4 #ifdef CAPSTONE_HAS_POWERPC
5 
6 #include "../../utils.h"
7 #include "../../MCRegisterInfo.h"
8 #include "PPCDisassembler.h"
9 #include "PPCInstPrinter.h"
10 #include "PPCMapping.h"
11 #include "PPCModule.h"
12 
PPC_global_init(cs_struct * ud)13 cs_err PPC_global_init(cs_struct *ud)
14 {
15 	MCRegisterInfo *mri;
16 	mri = (MCRegisterInfo *) cs_mem_malloc(sizeof(*mri));
17 
18 	PPC_init(mri);
19 	ud->printer = PPC_printInst;
20 	ud->printer_info = mri;
21 	ud->getinsn_info = mri;
22 	ud->disasm = PPC_getInstruction;
23 	ud->post_printer = PPC_post_printer;
24 
25 	ud->reg_name = PPC_reg_name;
26 	ud->insn_id = PPC_get_insn_id;
27 	ud->insn_name = PPC_insn_name;
28 	ud->group_name = PPC_group_name;
29 
30 	return CS_ERR_OK;
31 }
32 
PPC_option(cs_struct * handle,cs_opt_type type,size_t value)33 cs_err PPC_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 	if (type == CS_OPT_MODE) {
39 		handle->mode = (cs_mode)value;
40 	}
41 
42 	return CS_ERR_OK;
43 }
44 
45 #endif
46