Rizin
unix-like reverse engineering framework and cli tools
PPCModule.c
Go to the documentation of this file.
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 
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;
24 
25  ud->reg_name = PPC_reg_name;
29 
30  return CS_ERR_OK;
31 }
32 
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
void PPC_init(MCRegisterInfo *MRI)
bool PPC_getInstruction(csh ud, const uint8_t *code, size_t code_len, MCInst *instr, uint16_t *size, uint64_t address, void *info)
void PPC_printInst(MCInst *MI, SStream *O, void *Info)
void PPC_post_printer(csh ud, cs_insn *insn, char *insn_asm, MCInst *mci)
const char * PPC_insn_name(csh handle, unsigned int id)
void PPC_get_insn_id(cs_struct *h, cs_insn *insn, unsigned int id)
const char * PPC_reg_name(csh handle, unsigned int reg)
const char * PPC_group_name(csh handle, unsigned int id)
cs_err PPC_option(cs_struct *handle, cs_opt_type type, size_t value)
cs_err PPC_global_init(cs_struct *ud)
static mcore_handle handle
Definition: asm_mcore.c:8
cs_mode
Mode type.
Definition: capstone.h:102
cs_opt_type
Runtime option for the disassembled engine.
Definition: capstone.h:168
@ CS_OPT_MODE
Change engine's mode at run-time.
Definition: capstone.h:172
@ CS_OPT_SYNTAX
Assembly output syntax.
Definition: capstone.h:170
static int value
Definition: cmd_api.c:93
cs_malloc_t cs_mem_malloc
Definition: cs.c:348
int type
Definition: mipsasm.c:17
int CS_ERR_OK
Definition: __init__.py:235
static int
Definition: sfsocketcall.h:114
GetName_t insn_name
Definition: cs_priv.h:62
GetName_t reg_name
Definition: cs_priv.h:61
void * printer_info
Definition: cs_priv.h:58
Printer_t printer
Definition: cs_priv.h:57
GetID_t insn_id
Definition: cs_priv.h:64
GetName_t group_name
Definition: cs_priv.h:63
Disasm_t disasm
Definition: cs_priv.h:59
void * getinsn_info
Definition: cs_priv.h:60
PostPrinter_t post_printer
Definition: cs_priv.h:65