Rizin
unix-like reverse engineering framework and cli tools
M680XModule.c
Go to the documentation of this file.
1 /* Capstone Disassembly Engine */
2 /* M680X Backend by Wolfgang Schwotzer <wolfgang.schwotzer@gmx.net> 2017 */
3 
4 #ifdef CAPSTONE_HAS_M680X
5 
6 #include "../../utils.h"
7 #include "../../MCRegisterInfo.h"
8 #include "M680XDisassembler.h"
10 #include "M680XInstPrinter.h"
11 #include "M680XModule.h"
12 
13 cs_err M680X_global_init(cs_struct *ud)
14 {
16  cs_err errcode;
17 
18  /* Do some validation checks */
19  errcode = M680X_disassembler_init(ud);
20 
21  if (errcode != CS_ERR_OK)
22  return errcode;
23 
24  errcode = M680X_instprinter_init(ud);
25 
26  if (errcode != CS_ERR_OK)
27  return errcode;
28 
29  // verify if requested mode is valid
35  // At least one mode is not supported by M680X
36  return CS_ERR_MODE;
37  }
38 
44  // At least the cpu type has to be selected. No default.
45  return CS_ERR_MODE;
46  }
47 
48  info = cs_mem_malloc(sizeof(m680x_info));
49 
50  if (!info)
51  return CS_ERR_MEM;
52 
54  ud->printer_info = info;
55  ud->getinsn_info = NULL;
61  ud->skipdata_size = 1;
62  ud->post_printer = NULL;
63 #ifndef CAPSTONE_DIET
65 #endif
66 
67  return CS_ERR_OK;
68 }
69 
71 {
72  //TODO
73  return CS_ERR_OK;
74 }
75 
76 #endif
77 
cs_err M680X_instprinter_init(cs_struct *ud)
cs_err M680X_disassembler_init(cs_struct *ud)
bool M680X_getInstruction(csh ud, const uint8_t *code, size_t code_len, MCInst *instr, uint16_t *size, uint64_t address, void *info)
void M680X_get_insn_id(cs_struct *h, cs_insn *insn, unsigned int id)
void M680X_reg_access(const cs_insn *insn, cs_regs regs_read, uint8_t *regs_read_count, cs_regs regs_write, uint8_t *regs_write_count)
const char * M680X_reg_name(csh handle, unsigned int reg)
const char * M680X_insn_name(csh handle, unsigned int id)
const char * M680X_group_name(csh handle, unsigned int id)
void M680X_printInst(MCInst *MI, struct SStream *O, void *Info)
cs_err M680X_global_init(cs_struct *ud)
cs_err M680X_option(cs_struct *handle, cs_opt_type type, size_t value)
static mcore_handle handle
Definition: asm_mcore.c:8
RzBinInfo * info(RzBinFile *bf)
Definition: bin_ne.c:86
@ CS_MODE_M680X_6811
M680X Motorola/Freescale/NXP 68HC11 mode.
Definition: capstone.h:133
@ CS_MODE_M680X_6805
M680X Motorola/Freescale 6805 mode.
Definition: capstone.h:130
@ CS_MODE_M680X_HCS08
M680X Freescale/NXP HCS08 mode.
Definition: capstone.h:136
@ CS_MODE_M680X_6309
M680X Hitachi 6309 mode.
Definition: capstone.h:127
@ CS_MODE_M680X_CPU12
used on M68HC12/HCS12
Definition: capstone.h:134
@ CS_MODE_M680X_6301
M680X Hitachi 6301,6303 mode.
Definition: capstone.h:126
@ CS_MODE_M680X_6801
M680X Motorola 6801,6803 mode.
Definition: capstone.h:129
@ CS_MODE_M680X_6800
M680X Motorola 6800,6802 mode.
Definition: capstone.h:128
@ CS_MODE_M680X_6808
M680X Motorola/Freescale/NXP 68HC08 mode.
Definition: capstone.h:131
@ CS_MODE_M680X_6809
M680X Motorola 6809 mode.
Definition: capstone.h:132
cs_opt_type
Runtime option for the disassembled engine.
Definition: capstone.h:168
static int value
Definition: cmd_api.c:93
#define NULL
Definition: cris-opc.c:27
cs_malloc_t cs_mem_malloc
Definition: cs.c:348
int type
Definition: mipsasm.c:17
int CS_ERR_MEM
Definition: __init__.py:236
int CS_ERR_OK
Definition: __init__.py:235
int CS_ERR_MODE
Definition: __init__.py:240
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
GetRegisterAccess_t reg_access
Definition: cs_priv.h:77
Disasm_t disasm
Definition: cs_priv.h:59
cs_mode mode
Definition: cs_priv.h:56
void * getinsn_info
Definition: cs_priv.h:60
PostPrinter_t post_printer
Definition: cs_priv.h:65
uint8_t skipdata_size
Definition: cs_priv.h:74