6 #include <capstone/capstone.h>
8 #if CS_API_MAJOR >= 4 && CS_API_MINOR >= 0
9 #define CAPSTONE_HAS_M680X 1
11 #define CAPSTONE_HAS_M680X 0
14 #if !CAPSTONE_HAS_M680X
16 #pragma message("Cannot find support for m680x in capstone")
18 #warning Cannot find capstone-m680x support
22 #if CAPSTONE_HAS_M680X
25 static int m680xmode(
const char *
str) {
30 if (
str && strstr(
str,
"6800")) {
33 if (
str && strstr(
str,
"6801")) {
35 }
else if (
str && strstr(
str,
"6805")) {
37 }
else if (
str && strstr(
str,
"6808")) {
39 }
else if (
str && strstr(
str,
"6809")) {
41 }
else if (
str && strstr(
str,
"6811")) {
45 if (
str && strstr(
str,
"cpu12")) {
48 if (
str && strstr(
str,
"6301")) {
51 if (
str && strstr(
str,
"6309")) {
54 if (
str && strstr(
str,
"hcs08")) {
60 #define IMM(x) insn->detail->m680x.operands[x].imm
61 #define REL(x) insn->detail->m680x.operands[x].rel
64 int n, ret, opsize = -1;
66 static int omode = -1;
67 static int obits = 32;
70 int mode = m680xmode(
a->cpu);
72 if (
mode != omode ||
a->bits != obits) {
87 if (n < 1 || insn->
size < 1) {
100 opsize =
op->size = insn->size;
161 op->jump =
addr +
op->size + REL(0).offset;
188 op->jump =
addr +
op->size + REL(0).offset;
533 .desc =
"Capstone M680X analysis plugin",
543 .
name =
"m680x (unsupported)",
544 .desc =
"Capstone M680X analyzer (unsupported)",
551 #ifndef RZ_PLUGIN_INCORE
static int analop(RzAnalysis *a, RzAnalysisOp *op, ut64 addr, const ut8 *buf, int len, RzAnalysisOpMask mask)
RZ_API char * get_reg_profile(RzAnalysis *analysis)
RZ_API RzLibStruct rizin_plugin
RzAnalysisPlugin rz_analysis_plugin_m680x_cs
static mcore_handle handle
@ CS_ARCH_M680X
680X architecture
@ CS_MODE_M680X_6811
M680X Motorola/Freescale/NXP 68HC11 mode.
@ CS_MODE_M680X_6805
M680X Motorola/Freescale 6805 mode.
@ CS_MODE_M680X_HCS08
M680X Freescale/NXP HCS08 mode.
@ CS_MODE_M680X_6309
M680X Hitachi 6309 mode.
@ CS_MODE_M680X_CPU12
used on M68HC12/HCS12
@ CS_MODE_M680X_6301
M680X Hitachi 6301,6303 mode.
@ CS_MODE_M680X_6801
M680X Motorola 6801,6803 mode.
@ CS_MODE_M680X_6800
M680X Motorola 6800,6802 mode.
@ CS_MODE_M680X_6808
M680X Motorola/Freescale/NXP 68HC08 mode.
@ CS_MODE_M680X_6809
M680X Motorola 6809 mode.
@ CS_OPT_DETAIL
Break down instruction structure into details.
@ CS_OPT_ON
Turn ON an option (CS_OPT_DETAIL, CS_OPT_SKIPDATA).
CAPSTONE_EXPORT size_t CAPSTONE_API cs_disasm(csh ud, const uint8_t *buffer, size_t size, uint64_t offset, size_t count, cs_insn **insn)
CAPSTONE_EXPORT cs_err CAPSTONE_API cs_open(cs_arch arch, cs_mode mode, csh *handle)
CAPSTONE_EXPORT void CAPSTONE_API cs_free(cs_insn *insn, size_t count)
CAPSTONE_EXPORT cs_err CAPSTONE_API cs_close(csh *handle)
CAPSTONE_EXPORT cs_err CAPSTONE_API cs_option(csh ud, cs_opt_type type, size_t value)
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
@ M680X_INS_PULB
M6800/1/2/3.
@ M680X_INS_ABA
M6800/1/2/3.
@ M680X_INS_PSHB
M6800/1/2/3.
@ M680X_INS_ORAB
M6800/1/2/3.
@ M680X_INS_CBA
M6800/1/2/3.
@ M680X_INS_WAI
M6800/1/2/3.
@ M680X_INS_LDAB
M6800/1/2/3.
@ M680X_INS_TBA
M6800/1/2/3.
@ M680X_INS_PSHX
M6800/1/2/3.
@ M680X_INS_TPA
M6800/1/2/3.
@ M680X_INS_CLI
M6800/1/2/3.
@ M680X_INS_PULA
M6800/1/2/3.
@ M680X_INS_STAB
M6800/1/2/3.
@ M680X_INS_TXS
M6800/1/2/3.
@ M680X_INS_DES
M6800/1/2/3.
@ M680X_INS_TAB
M6800/1/2/3.
@ M680X_INS_ORAA
M6800/1/2/3.
@ M680X_INS_TAP
M6800/1/2/3.
@ M680X_INS_INS
M6800/1/2/3.
@ M680X_INS_TSX
M6800/1/2/3.
@ M680X_INS_CLC
M6800/1/2/3.
@ M680X_INS_STAA
M6800/1/2/3.
@ M680X_INS_PSHA
M6800/1/2/3.
@ M680X_INS_SBA
M6800/1/2/3.
@ M680X_INS_LDAA
M6800/1/2/3.
@ M680X_INS_INX
M6800/1/2/3.
@ M680X_INS_CLV
M6800/1/2/3.
@ M680X_INS_CPX
M6800/1/2/3.
@ M680X_INS_DEX
M6800/1/2/3.
@ M680X_INS_PULX
M6800/1/2/3.
@ RZ_ANALYSIS_OP_TYPE_CMP
@ RZ_ANALYSIS_OP_TYPE_SUB
@ RZ_ANALYSIS_OP_TYPE_MUL
@ RZ_ANALYSIS_OP_TYPE_JMP
@ RZ_ANALYSIS_OP_TYPE_SWI
@ RZ_ANALYSIS_OP_TYPE_ADD
@ RZ_ANALYSIS_OP_TYPE_RJMP
@ RZ_ANALYSIS_OP_TYPE_CJMP
@ RZ_ANALYSIS_OP_TYPE_DIV
@ RZ_ANALYSIS_OP_TYPE_MOV
@ RZ_ANALYSIS_OP_TYPE_ILL
@ RZ_ANALYSIS_OP_TYPE_NOT
@ RZ_ANALYSIS_OP_TYPE_NOP
@ RZ_ANALYSIS_OP_TYPE_XOR
ut64(WINAPI *w32_GetEnabledXStateFeatures)()