12 #include "../../cs_priv.h"
13 #include "../../utils.h"
15 #include "../../MCInst.h"
16 #include "../../MCInstrDesc.h"
17 #include "../../MCRegisterInfo.h"
22 #ifdef CAPSTONE_HAS_M680X
26 #define DECL_SPEC __cdecl
40 typedef enum insn_hdlr_id {
85 typedef enum e_access_mode {
106 typedef enum e_access {
114 typedef struct inst_page1 {
116 insn_hdlr_id handler_id1 : 6;
117 insn_hdlr_id handler_id2 : 6;
121 typedef struct inst_pageX {
124 insn_hdlr_id handler_id1 : 6;
125 insn_hdlr_id handler_id2 : 6;
128 typedef struct insn_props {
130 e_access_mode access_mode : 5;
133 bool cc_modified : 1;
134 bool update_reg_access : 1;
139 #include "hd6301.inc"
146 #include "hd6309.inc"
148 #include "insn_props.inc"
212 static int binary_search(
const inst_pageX *
const inst_pageX_table,
216 int last = table_size - 1;
217 int middle = (
first + last) / 2;
219 while (
first <= last) {
229 middle = (
first + last) / 2;
242 uint8_t insn_prefix = (
id >> 8) & 0xff;
248 for (
i = 0;
i <
ARR_SIZE(cpu->pageX_prefix); ++
i) {
249 if (cpu->pageX_table_size[
i] == 0 ||
250 (cpu->inst_pageX_table[
i] == NULL))
253 if (cpu->pageX_prefix[
i] == insn_prefix) {
254 index = binary_search(cpu->inst_pageX_table[
i],
255 cpu->pageX_table_size[
i],
id & 0xff);
256 insn->id = (
index >= 0) ?
257 cpu->inst_pageX_table[
i][
index].insn :
263 if (insn_prefix != 0)
266 insn->id = cpu->inst_page1_table[
id].insn;
272 for (
i = 0;
i <
ARR_SIZE(cpu->overlay_table_size); ++
i) {
273 if (cpu->overlay_table_size[
i] == 0 ||
274 (cpu->inst_overlay_table[
i] == NULL))
277 if ((
index = binary_search(cpu->inst_overlay_table[
i],
278 cpu->overlay_table_size[
i],
280 insn->id = cpu->inst_overlay_table[
i][
index].insn;
315 detail->regs_read_count, reg))
323 detail->regs_write_count, reg))
331 detail->regs_read_count, reg))
365 if (
op->idx.inc_dec) {
380 static const e_access g_access_mode_to_access[4][15] = {
382 UNCHANGED, READ,
WRITE, READ, READ, READ,
WRITE, MODIFY,
383 MODIFY, MODIFY, MODIFY, MODIFY,
WRITE, READ, MODIFY,
386 UNCHANGED, READ,
WRITE,
WRITE, READ, MODIFY, READ, READ,
387 WRITE, MODIFY,
WRITE, MODIFY, MODIFY, READ, UNCHANGED,
390 UNCHANGED, READ,
WRITE,
WRITE, READ, MODIFY, READ, READ,
391 WRITE, MODIFY, READ, READ, MODIFY, UNCHANGED, UNCHANGED,
394 UNCHANGED, READ,
WRITE,
WRITE, MODIFY, MODIFY, READ, READ,
395 WRITE, MODIFY, READ, READ, MODIFY, UNCHANGED, UNCHANGED,
399 static e_access get_access(
int operator_index, e_access_mode access_mode)
401 int idx = (operator_index > 3) ? 3 : operator_index;
403 return g_access_mode_to_access[
idx][access_mode];
407 e_access_mode access_mode)
417 e_access
access = get_access(
i, access_mode);
423 e_access_mode access_mode)
430 (access_mode == uuuu))
446 typedef struct insn_to_changed_regs {
448 e_access_mode access_mode;
450 } insn_to_changed_regs;
452 static void set_changed_regs_read_write_counts(
MCInst *MI,
m680x_info *info)
455 #define EOL M680X_REG_INVALID
456 static const insn_to_changed_regs changed_regs[] = {
590 if (info->
insn == changed_regs[
i].insn) {
591 e_access_mode access_mode = changed_regs[
i].access_mode;
593 for (j = 0; changed_regs[
i].regs[
j] != EOL; ++
j) {
606 access = get_access(j, access_mode);
615 typedef struct insn_desc {
622 static bool is_indexed09_post_byte_valid(
const m680x_info *info,
628 switch (post_byte & 0x9F) {
644 insn_description->insn_size++;
645 return read_byte(info, &ir, (*address)++);
651 insn_description->insn_size += 2;
652 retval = read_byte(info, &ir, *address + 1);
657 insn_description->insn_size += 2;
658 retval = (post_byte & 0x60) == 0 &&
659 read_byte(info, &ir, *address + 1);
668 static bool is_indexed12_post_byte_valid(
const m680x_info *info,
675 if (!(post_byte & 0x20))
678 switch (post_byte & 0xe7) {
684 insn_description->insn_size++;
685 return read_byte(info, &ir, (*address)++);
692 insn_description->insn_size += 2;
693 result = read_byte(info, &ir, *address + 1);
718 static bool is_exg_tfr12_post_byte_valid(
const m680x_info *info,
721 return !(post_byte & 0x08);
727 return reg_nibble <= 4;
733 if (post_byte >= 0xc0)
736 return ((post_byte & 0x07) != 2 && ((post_byte & 0x07) != 3));
740 insn_desc *insn_description)
745 for (
i = 0;
i < 2;
i++) {
747 bool is_subset =
false;
749 switch (insn_description->hid[
i]) {
752 insn_description->insn_size += 4;
753 retval = read_byte(info, &ir, address + 3);
764 insn_description->insn_size += 2;
765 retval = read_byte(info, &ir, address + 1);
778 insn_description->insn_size += 1;
779 retval = read_byte(info, &ir, address++);
791 insn_description->insn_size += 1;
793 if (!read_byte(info, &ir, address++))
796 retval = is_indexed09_post_byte_valid(info,
797 &address, ir, insn_description);
807 insn_description->insn_size += 1;
809 if (!read_byte(info, &ir, address++))
812 retval = is_indexed12_post_byte_valid(info,
813 &address, ir, insn_description,
820 insn_description->insn_size += 1;
822 if (!read_byte(info, &ir, address++))
824 else if (!is_indexed12_post_byte_valid(info, &address,
825 ir, insn_description,
false))
828 insn_description->insn_size += 2;
829 retval = read_byte(info, &ir, address + 1);
836 insn_description->insn_size += 1;
838 if (!read_byte(info, &ir, address++))
840 else if (!is_indexed12_post_byte_valid(info, &address,
841 ir, insn_description,
false))
844 insn_description->insn_size += 1;
845 retval = read_byte(info, &ir, address++);
851 insn_description->insn_size += 1;
853 if (!read_byte(info, &ir, address++))
856 retval = is_tfm_reg_valid(info, (ir >> 4) & 0x0F) &&
857 is_tfm_reg_valid(info, ir & 0x0F);
862 insn_description->insn_size += 1;
864 if (!read_byte(info, &ir, address++))
867 retval = is_tfr09_reg_valid(info, (ir >> 4) & 0x0F) &&
868 is_tfr09_reg_valid(info, ir & 0x0F);
873 insn_description->insn_size += 1;
875 if (!read_byte(info, &ir, address++))
878 retval = is_exg_tfr12_post_byte_valid(info, ir);
883 insn_description->insn_size += 2;
885 if (!read_byte(info, &ir, address++))
887 else if ((ir & 0xc0) == 0xc0)
890 retval = read_byte(info, &ir, address++);
895 insn_description->insn_size += 2;
897 if (!read_byte(info, &ir, address++))
899 else if (!is_loop_post_byte_valid(info, ir))
902 retval = read_byte(info, &ir, address++);
907 fprintf(
stderr,
"Internal error: Unexpected instruction "
908 "handler id %d\n", insn_description->hid[
i]);
923 insn_desc *insn_description)
925 const inst_pageX *inst_table = NULL;
933 if (!read_byte(info, &ir, address++))
937 insn_description->opcode = ir;
951 if (!read_byte(info, &ir, address++))
954 insn_description->opcode =
955 (insn_description->opcode << 8) | ir;
957 if ((
index = binary_search(inst_table, table_size, ir)) < 0)
960 insn_description->hid[0] =
961 inst_table[
index].handler_id1;
962 insn_description->hid[1] =
963 inst_table[
index].handler_id2;
964 insn_description->insn = inst_table[
index].insn;
972 insn_description->hid[0] =
974 insn_description->hid[1] =
988 if ((
index = binary_search(inst_table, table_size,
990 insn_description->hid[0] =
991 inst_table[
index].handler_id1;
992 insn_description->hid[1] =
993 inst_table[
index].handler_id2;
994 insn_description->insn = inst_table[
index].insn;
1000 insn_description->insn_size = address - base_address;
1004 is_sufficient_code_size(info, address, insn_description);
1013 read_byte(info, &temp8, (*address)++);
1054 op->size = default_size;
1057 static const m680x_reg reg_s_reg_ids[] = {
1062 static const m680x_reg reg_u_reg_ids[] = {
1074 read_byte(info, ®_bits, (*address)++);
1078 reg_to_reg_ids = ®_u_reg_ids[0];
1082 reg_to_reg_ids = ®_s_reg_ids[0];
1086 fprintf(
stderr,
"Internal error: Unexpected operand0 register "
1093 ((reg_bits & 0x80) != 0))
1098 for (bit_index = 0; bit_index < 8; ++bit_index) {
1099 if (reg_bits & (1 << bit_index))
1100 add_reg_operand(info, reg_to_reg_ids[bit_index]);
1104 static const m680x_reg g_tfr_exg_reg_ids[] = {
1117 read_byte(info, ®s, (*address)++);
1119 add_reg_operand(info, g_tfr_exg_reg_ids[regs >> 4]);
1120 add_reg_operand(info, g_tfr_exg_reg_ids[regs & 0x0f]);
1122 if ((regs & 0x0f) == 0x05) {
1131 static const m680x_reg g_tfr_exg12_reg0_ids[] = {
1135 static const m680x_reg g_tfr_exg12_reg1_ids[] = {
1141 read_byte(info, ®s, (*address)++);
1150 add_reg_operand(info, g_tfr_exg12_reg0_ids[(regs >> 4) & 0x07]);
1151 add_reg_operand(info, g_tfr_exg12_reg1_ids[regs & 0x07]);
1162 op->rel.address = address;
1169 read_byte_sign_extended(info, &
offset, (*address)++);
1183 read_word(info, &
offset, *address);
1194 static const m680x_reg g_rr5_to_reg_ids[] = {
1206 set_operand_size(info,
op, 1);
1207 op->idx.base_reg = base_reg;
1209 op->idx.inc_dec = inc_dec;
1211 if (inc_dec && post_inc_dec)
1216 op->idx.offset_addr = 0;
1219 op->idx.offset_bits = offset_bits;
1228 read_byte(info, &
offset, (*address)++);
1238 read_byte(info, &
offset, (*address)++);
1253 read_byte(info, &post_byte, (*address)++);
1256 set_operand_size(info,
op, 1);
1257 op->idx.base_reg = g_rr5_to_reg_ids[(post_byte >> 5) & 0x03];
1260 if (!(post_byte & 0x80)) {
1262 if ((post_byte & 0x10) == 0x10)
1263 op->idx.offset = post_byte | 0xfff0;
1265 op->idx.offset = post_byte & 0x0f;
1267 op->idx.offset_addr =
op->idx.offset + *address;
1271 if ((post_byte & 0x10) == 0x10)
1275 switch (post_byte & 0x1f) {
1277 op->idx.inc_dec = 1;
1283 op->idx.inc_dec = 2;
1288 op->idx.inc_dec = -1;
1293 op->idx.inc_dec = -2;
1313 read_byte_sign_extended(info, &soffset, (*address)++);
1314 op->idx.offset_addr =
offset + *address;
1315 op->idx.offset = soffset;
1321 read_byte_sign_extended(info, &soffset, (*address)++);
1322 op->idx.offset = soffset;
1329 read_word(info, &
offset, *address);
1331 op->idx.offset_addr =
offset + *address;
1338 read_word(info, &
offset, *address);
1351 op->ext.indirect =
true;
1352 read_word(info, &
op->ext.address, *address);
1389 read_byte(info, &post_byte, (*address)++);
1392 set_operand_size(info,
op, 1);
1395 if (!(post_byte & 0x20)) {
1397 op->idx.base_reg = g_idx12_to_reg_ids[(post_byte >> 6) & 0x03];
1399 if ((post_byte & 0x10) == 0x10)
1400 op->idx.offset = post_byte | 0xfff0;
1402 op->idx.offset = post_byte & 0x0f;
1404 op->idx.offset_addr =
op->idx.offset + *address;
1408 if ((post_byte & 0xe0) == 0xe0)
1410 g_idx12_to_reg_ids[(post_byte >> 3) & 0x03];
1412 switch (post_byte & 0xe7) {
1415 read_byte(info, &offset8, (*address)++);
1416 op->idx.offset = offset8;
1418 if (post_byte & 0x01)
1419 op->idx.offset |= 0xff00;
1424 op->idx.offset_addr =
op->idx.offset + *address;
1433 read_word(info, (
uint16_t *)&
op->idx.offset, *address);
1438 op->idx.offset_addr =
op->idx.offset + *address;
1445 op->idx.offset_reg =
1446 g_or12_to_reg_ids[post_byte & 0x03];
1457 g_idx12_to_reg_ids[(post_byte >> 6) & 0x03];
1458 op->idx.inc_dec = post_byte & 0x0f;
1460 if (
op->idx.inc_dec & 0x08)
1461 op->idx.inc_dec |= 0xf0;
1463 if (
op->idx.inc_dec >= 0)
1466 if (post_byte & 0x10)
1481 read_byte(info, &
op->const_val, (*address)++);
1490 set_operand_size(info,
op, 1);
1491 read_byte(info, &
op->direct_addr, (*address)++);
1500 set_operand_size(info,
op, 1);
1501 read_word(info, &
op->ext.address, *address);
1513 set_operand_size(info,
op, 1);
1517 read_byte_sign_extended(info, &sword, *address);
1522 read_word(info, &word, *address);
1527 read_sdword(info, &
op->imm, *address);
1532 fprintf(
stderr,
"Internal error: Unexpected immediate byte "
1533 "size %d.\n",
op->size);
1536 *address +=
op->size;
1550 read_byte(info, &post_byte, *address);
1554 add_reg_operand(info,
m680x_reg[post_byte >> 6]);
1559 op->const_val = (post_byte >> 3) & 0x07;
1564 op->const_val = post_byte & 0x07;
1566 direct_hdlr(MI, info, address);
1572 static const uint8_t inc_dec_r0[] = {
1575 static const uint8_t inc_dec_r1[] = {
1581 read_byte(info, ®s, *address);
1583 add_indexed_operand(info, g_tfr_exg_reg_ids[regs >> 4],
true,
1585 add_indexed_operand(info, g_tfr_exg_reg_ids[regs & 0x0f],
true,
1598 op->const_val = (MI->
Opcode & 0x0e) >> 1;
1611 op->const_val = (MI->
Opcode & 0x0e) >> 1;
1612 direct_hdlr(MI, info, address);
1613 relative8_hdlr(MI, info, address);
1628 read_word(info, &
offset, *address);
1636 immediate_hdlr(MI, info, address);
1637 relative8_hdlr(MI, info, address);
1644 read_byte(info, &
offset, (*address)++);
1654 read_word(info, &
offset, *address);
1671 read_byte(info, &
offset, (*address)++);
1682 indexed12_hdlr(MI, info, address);
1688 read_word(info, &imm16, *address);
1695 read_byte(info, &imm8, *address);
1700 set_operand_size(info,
op, 1);
1709 indexed12_hdlr(MI, info, address);
1710 read_word(info, &imm16, *address);
1713 set_operand_size(info, op0, 1);
1720 static const m680x_reg index_to_reg_id[] = {
1724 static const m680x_insn index_to_insn_id[] = {
1733 read_byte(info, &post_byte, (*address)++);
1735 info->
insn = index_to_insn_id[(post_byte >> 5) & 0x07];
1738 fprintf(
stderr,
"Internal error: Unexpected post byte "
1739 "in loop instruction %02X.\n", post_byte);
1740 illegal_hdlr(MI, info, address);
1743 read_byte(info, &
rel, (*address)++);
1745 add_reg_operand(info, index_to_reg_id[post_byte & 0x07]);
1751 op->rel.offset = (post_byte & 0x10) ? 0xff00 |
rel :
rel;
1753 op->rel.address = *address +
op->rel.offset;
1801 insn_desc insn_description;
1802 e_access_mode access_mode;
1808 memset(&insn_description, 0,
sizeof(insn_description));
1809 memset(m680x, 0,
sizeof(*m680x));
1812 if (decode_insn(info, address, &insn_description)) {
1815 if (insn_description.opcode > 0xff)
1820 info->
insn = insn_description.insn;
1824 reg = g_insn_props[info->
insn].reg0;
1831 add_reg_operand(info, reg);
1835 reg = g_insn_props[info->
insn].reg1;
1842 add_reg_operand(info, reg);
1848 (g_insn_handler[insn_description.hid[0]])(MI, info,
1850 (g_insn_handler[insn_description.hid[1]])(MI, info,
1853 add_insn_group(
detail, g_insn_props[info->
insn].group);
1855 if (g_insn_props[info->
insn].cc_modified &&
1860 access_mode = g_insn_props[info->
insn].access_mode;
1869 add_operators_access(MI, info, access_mode);
1871 if (g_insn_props[info->
insn].update_reg_access)
1872 set_changed_regs_read_write_counts(MI, info);
1874 info->
insn_size = insn_description.insn_size;
1882 address = base_address;
1883 illegal_hdlr(MI, info, &address);
1890 static const uint8_t g_m6800_reg_byte_size[22] = {
1892 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 2, 0, 0
1895 static const uint8_t g_m6805_reg_byte_size[22] = {
1897 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2, 0, 0, 0, 2, 0, 0
1900 static const uint8_t g_m6808_reg_byte_size[22] = {
1902 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 1, 1, 0, 2, 0, 0, 0, 2, 0, 0
1905 static const uint8_t g_m6801_reg_byte_size[22] = {
1907 0, 1, 1, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 2, 0, 0
1910 static const uint8_t g_m6811_reg_byte_size[22] = {
1912 0, 1, 1, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 2, 0, 0
1915 static const uint8_t g_cpu12_reg_byte_size[22] = {
1917 0, 1, 1, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 2, 2, 2
1920 static const uint8_t g_m6809_reg_byte_size[22] = {
1922 0, 1, 1, 0, 0, 0, 2, 0, 1, 1, 0, 0, 0, 2, 2, 2, 2, 0, 0, 2, 0, 0
1925 static const uint8_t g_hd6309_reg_byte_size[22] = {
1927 0, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 0, 0, 2, 2, 2, 2, 2, 4, 2, 0, 0
1932 static const bool m6809_tfr_reg_valid[16] = {
1933 true,
true,
true,
true,
true,
true,
false,
false,
1934 true,
true,
true,
true,
false,
false,
false,
false,
1943 { 0x00, 0x00, 0x00 },
1944 { NULL, NULL, NULL },
1952 &g_m6800_inst_page1_table[0],
1953 { &g_m6801_inst_overlay_table[0], &g_hd6301_inst_overlay_table[0] },
1955 ARR_SIZE(g_m6801_inst_overlay_table),
1956 ARR_SIZE(g_hd6301_inst_overlay_table)
1958 { 0x00, 0x00, 0x00 },
1959 { NULL, NULL, NULL },
1961 &g_m6801_reg_byte_size[0],
1967 &g_m6809_inst_page1_table[0],
1968 { &g_hd6309_inst_overlay_table[0], NULL },
1969 {
ARR_SIZE(g_hd6309_inst_overlay_table), 0 },
1970 { 0x10, 0x11, 0x00 },
1971 { &g_hd6309_inst_page2_table[0], &g_hd6309_inst_page3_table[0], NULL },
1973 ARR_SIZE(g_hd6309_inst_page2_table),
1974 ARR_SIZE(g_hd6309_inst_page3_table),
1977 &g_hd6309_reg_byte_size[0],
1983 &g_m6800_inst_page1_table[0],
1986 { 0x00, 0x00, 0x00 },
1987 { NULL, NULL, NULL },
1989 &g_m6800_reg_byte_size[0],
1995 &g_m6800_inst_page1_table[0],
1996 { &g_m6801_inst_overlay_table[0], NULL },
1997 {
ARR_SIZE(g_m6801_inst_overlay_table), 0 },
1998 { 0x00, 0x00, 0x00 },
1999 { NULL, NULL, NULL },
2001 &g_m6801_reg_byte_size[0],
2007 &g_m6805_inst_page1_table[0],
2010 { 0x00, 0x00, 0x00 },
2011 { NULL, NULL, NULL },
2013 &g_m6805_reg_byte_size[0],
2019 &g_m6805_inst_page1_table[0],
2020 { &g_m6808_inst_overlay_table[0], NULL },
2021 {
ARR_SIZE(g_m6808_inst_overlay_table), 0 },
2022 { 0x9E, 0x00, 0x00 },
2023 { &g_m6808_inst_page2_table[0], NULL, NULL },
2024 {
ARR_SIZE(g_m6808_inst_page2_table), 0, 0 },
2025 &g_m6808_reg_byte_size[0],
2031 &g_m6809_inst_page1_table[0],
2034 { 0x10, 0x11, 0x00 },
2036 &g_m6809_inst_page2_table[0],
2037 &g_m6809_inst_page3_table[0],
2041 ARR_SIZE(g_m6809_inst_page2_table),
2042 ARR_SIZE(g_m6809_inst_page3_table),
2045 &g_m6809_reg_byte_size[0],
2046 &m6809_tfr_reg_valid[0],
2051 &g_m6800_inst_page1_table[0],
2053 &g_m6801_inst_overlay_table[0],
2054 &g_m6811_inst_overlay_table[0]
2057 ARR_SIZE(g_m6801_inst_overlay_table),
2058 ARR_SIZE(g_m6811_inst_overlay_table)
2060 { 0x18, 0x1A, 0xCD },
2062 &g_m6811_inst_page2_table[0],
2063 &g_m6811_inst_page3_table[0],
2064 &g_m6811_inst_page4_table[0]
2067 ARR_SIZE(g_m6811_inst_page2_table),
2068 ARR_SIZE(g_m6811_inst_page3_table),
2071 &g_m6811_reg_byte_size[0],
2077 &g_cpu12_inst_page1_table[0],
2080 { 0x18, 0x00, 0x00 },
2081 { &g_cpu12_inst_page2_table[0], NULL, NULL },
2082 {
ARR_SIZE(g_cpu12_inst_page2_table), 0, 0 },
2083 &g_cpu12_reg_byte_size[0],
2089 &g_m6805_inst_page1_table[0],
2091 &g_m6808_inst_overlay_table[0],
2092 &g_hcs08_inst_overlay_table[0]
2095 ARR_SIZE(g_m6808_inst_overlay_table),
2096 ARR_SIZE(g_hcs08_inst_overlay_table)
2098 { 0x9E, 0x00, 0x00 },
2099 { &g_hcs08_inst_page2_table[0], NULL, NULL },
2100 {
ARR_SIZE(g_hcs08_inst_page2_table), 0, 0 },
2101 &g_m6808_reg_byte_size[0],
2107 static const char *s_cpu_type[] = {
2108 "INVALID",
"6301",
"6309",
"6800",
"6801",
"6805",
"6808",
2109 "6809",
"6811",
"CPU12",
"HCS08",
2117 fprintf(
stderr,
"M680X_CPU_TYPE_%s is not suppported\n",
2118 s_cpu_type[cpu_type]);
2123 info->
size = code_len;
2135 unsigned int insn_size = 0;
2173 m680x_setup_internals(info, cpu_type, (
uint16_t)address,
code,
2175 insn_size = m680x_disassemble(MI, info, (
uint16_t)address);
2177 if (insn_size == 0) {
2183 if (insn_size > code_len) {
2196 fprintf(
stderr,
"Internal error: Size mismatch in enum "
2197 "m680x_reg and g_m6800_reg_byte_size\n");
2203 fprintf(
stderr,
"Internal error: Size mismatch in enum "
2204 "m680x_reg and g_m6801_reg_byte_size\n");
2210 fprintf(
stderr,
"Internal error: Size mismatch in enum "
2211 "m680x_reg and g_m6805_reg_byte_size\n");
2217 fprintf(
stderr,
"Internal error: Size mismatch in enum "
2218 "m680x_reg and g_m6808_reg_byte_size\n");
2224 fprintf(
stderr,
"Internal error: Size mismatch in enum "
2225 "m680x_reg and g_m6811_reg_byte_size\n");
2231 fprintf(
stderr,
"Internal error: Size mismatch in enum "
2232 "m680x_reg and g_cpu12_reg_byte_size\n");
2238 fprintf(
stderr,
"Internal error: Size mismatch in enum "
2239 "m680x_reg and g_m6809_reg_byte_size\n");
2245 fprintf(
stderr,
"Internal error: Size mismatch in enum "
2246 "m680x_insn and g_insn_props\n");
2252 fprintf(
stderr,
"Internal error: Size mismatch in enum "
2253 "e_cpu_type and s_cpu_type\n");
2259 fprintf(
stderr,
"Internal error: Size mismatch in enum "
2260 "e_cpu_type and g_cpu_tables\n");
2265 if (HANDLER_ID_ENDING !=
ARR_SIZE(g_insn_handler)) {
2266 fprintf(
stderr,
"Internal error: Size mismatch in enum "
2267 "insn_hdlr_id and g_insn_handler\n");
2272 if (ACCESS_MODE_ENDING !=
MATRIX_SIZE(g_access_mode_to_access)) {
2273 fprintf(
stderr,
"Internal error: Size mismatch in enum "
2274 "e_access_mode and g_access_mode_to_access\n");
2282 #ifndef CAPSTONE_DIET
2284 cs_regs regs_read,
uint8_t *regs_read_count,
2285 cs_regs regs_write,
uint8_t *regs_write_count)
2287 if (insn->detail == NULL) {
2288 *regs_read_count = 0;
2289 *regs_write_count = 0;
2292 *regs_read_count = insn->detail->regs_read_count;
2293 *regs_write_count = insn->detail->regs_write_count;
2295 memcpy(regs_read, insn->detail->regs_read,
2296 *regs_read_count *
sizeof(insn->detail->regs_read[0]));
2297 memcpy(regs_write, insn->detail->regs_write,
2299 sizeof(insn->detail->regs_write[0]));