blob: 014e983e74bdc49e0bf63fa5b3f4e74ff8246686 [file] [log] [blame]
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +08001/* Capstone Disassembler Engine */
2/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013> */
3
4#ifndef __CS_PRIV_H__
5#define __CS_PRIV_H__
6
7#include <capstone.h>
8
9#include "MCInst.h"
10#include "SStream.h"
11
12typedef void (*Printer_t)(MCInst *MI, SStream *OS, void *info);
13
14// function to be called after Printer_t
15// this is the best time to gather insn's characteristics
16typedef void (*PostPrinter_t)(unsigned int insn, cs_insn *, char *mnem);
17
pancakec04f8732013-12-03 02:51:46 +010018typedef bool (*Disasm_t)(csh handle, unsigned char *code, size_t code_len, MCInst *instr, uint16_t *size, uint64_t address, void *info);
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +080019
20typedef char *(*GetName_t)(unsigned int reg);
21
22typedef void (*GetID_t)(cs_insn *insn, unsigned int id);
23
Nguyen Anh Quynh7c7a8bc2013-12-02 13:16:44 +080024// for ARM only
25typedef struct ARM_ITStatus {
26 unsigned char ITStates[128]; // FIXME
27 unsigned int size;
28} ARM_ITStatus;
29
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +080030typedef struct cs_struct {
31 cs_arch arch;
32 cs_mode mode;
33 Printer_t printer; // asm printer
34 void *printer_info; // aux info for printer
35 Disasm_t disasm; // disassembler
36 void *getinsn_info; // auxiliary info for printer
37 bool big_endian;
38 GetName_t reg_name;
39 GetName_t insn_name;
40 GetID_t insn_id;
41 PostPrinter_t post_printer;
42 bool micro_mips; // for Mips only
Nguyen Anh Quynh3eb9ac92013-11-27 15:24:47 +080043 cs_err errnum;
Nguyen Anh Quynh7c7a8bc2013-12-02 13:16:44 +080044 ARM_ITStatus ITBlock; // for Arm only
Nguyen Anh Quynh26ee41a2013-11-27 12:11:31 +080045} cs_struct;
46
47#endif