• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Capstone Disassembly Engine */
2 /* M680X Backend by Wolfgang Schwotzer <wolfgang.schwotzer@gmx.net> 2017 */
3 
4 #ifndef CS_M680XDISASSEMBLERINTERNALS_H
5 #define CS_M680XDISASSEMBLERINTERNALS_H
6 
7 #include "../../MCInst.h"
8 #include "../../include/capstone/m680x.h"
9 
10 typedef enum e_cpu_type {
11 	M680X_CPU_TYPE_INVALID,
12 	M680X_CPU_TYPE_6301,	// M680X Hitachi HD6301,HD6303 mode
13 	M680X_CPU_TYPE_6309,	// M680X Hitachi HD6309 mode
14 	M680X_CPU_TYPE_6800,	// M680X Motorola 6800,6802 mode
15 	M680X_CPU_TYPE_6801,	// M680X Motorola 6801,6803 mode
16 	M680X_CPU_TYPE_6805,	// M680X Motorola/Freescale M68HC05 mode
17 	M680X_CPU_TYPE_6808,	// M680X Motorola/Freescale M68HC08 mode
18 	M680X_CPU_TYPE_6809,	// M680X Motorola 6809 mode
19 	M680X_CPU_TYPE_6811,	// M680X Motorola/Freescale M68HC11 mode
20 	M680X_CPU_TYPE_CPU12,	// M680X Motorola/Freescale CPU12 mode
21 	// used on M68HC12/HCS12
22 	M680X_CPU_TYPE_HCS08,	// M680X Freescale HCS08 mode
23 	M680X_CPU_TYPE_ENDING,
24 } e_cpu_type;
25 
26 struct inst_page1;
27 struct inst_pageX;
28 
29 typedef struct {
30 	const struct inst_page1 *inst_page1_table;
31 	const struct inst_pageX *inst_overlay_table[2];
32 	size_t overlay_table_size[2];
33 	uint8_t pageX_prefix[3];
34 	const struct inst_pageX *inst_pageX_table[3];
35 	size_t pageX_table_size[3];
36 	const uint8_t *reg_byte_size;
37 	const bool *tfr_reg_valid;
38 	m680x_insn insn_cc_not_modified[2];
39 } cpu_tables;
40 
41 /* Private, For internal use only */
42 typedef struct m680x_info {
43 	const uint8_t *code;	// code buffer
44 	uint32_t size;		// byte size of code
45 	uint16_t offset;	// address offset of first byte in code buffer
46 	e_cpu_type cpu_type;	// The CPU type to be used for disassembling
47 	cs_m680x m680x;		// M680X specific properties
48 	const cpu_tables *cpu;
49 	m680x_insn insn;	// Instruction ID
50 	uint8_t insn_size;	// byte size of instruction
51 } m680x_info;
52 
53 extern cs_err M680X_disassembler_init(cs_struct *ud);
54 extern cs_err M680X_instprinter_init(cs_struct *ud);
55 
56 #endif
57 
58