Nguyen Anh Quynh | 26ee41a | 2013-11-27 12:11:31 +0800 | [diff] [blame] | 1 | /* 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 | |
| 12 | typedef 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 |
| 16 | typedef void (*PostPrinter_t)(unsigned int insn, cs_insn *, char *mnem); |
| 17 | |
pancake | c04f873 | 2013-12-03 02:51:46 +0100 | [diff] [blame] | 18 | typedef bool (*Disasm_t)(csh handle, unsigned char *code, size_t code_len, MCInst *instr, uint16_t *size, uint64_t address, void *info); |
Nguyen Anh Quynh | 26ee41a | 2013-11-27 12:11:31 +0800 | [diff] [blame] | 19 | |
| 20 | typedef char *(*GetName_t)(unsigned int reg); |
| 21 | |
| 22 | typedef void (*GetID_t)(cs_insn *insn, unsigned int id); |
| 23 | |
Nguyen Anh Quynh | 7c7a8bc | 2013-12-02 13:16:44 +0800 | [diff] [blame] | 24 | // for ARM only |
| 25 | typedef struct ARM_ITStatus { |
| 26 | unsigned char ITStates[128]; // FIXME |
| 27 | unsigned int size; |
| 28 | } ARM_ITStatus; |
| 29 | |
Nguyen Anh Quynh | 26ee41a | 2013-11-27 12:11:31 +0800 | [diff] [blame] | 30 | typedef 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 Quynh | 3eb9ac9 | 2013-11-27 15:24:47 +0800 | [diff] [blame] | 43 | cs_err errnum; |
Nguyen Anh Quynh | 7c7a8bc | 2013-12-02 13:16:44 +0800 | [diff] [blame] | 44 | ARM_ITStatus ITBlock; // for Arm only |
Nguyen Anh Quynh | 26ee41a | 2013-11-27 12:11:31 +0800 | [diff] [blame] | 45 | } cs_struct; |
| 46 | |
| 47 | #endif |