6 #ifndef _CRT_SECURE_NO_WARNINGS
7 #define _CRT_SECURE_NO_WARNINGS
12 #pragma warning(disable:28719)
23 #include "../../cs_priv.h"
24 #include "../../utils.h"
26 #include "../../MCInst.h"
27 #include "../../MCInstrDesc.h"
28 #include "../../MCRegisterInfo.h"
35 "d0",
"d1",
"d2",
"d3",
"d4",
"d5",
"d6",
"d7",
36 "a0",
"a1",
"a2",
"a3",
"a4",
"a5",
"a6",
"a7",
37 "fp0",
"fp1",
"fp2",
"fp3",
"fp4",
"fp5",
"fp6",
"fp7",
39 "sr",
"ccr",
"sfc",
"dfc",
"usp",
"vbr",
"cacr",
40 "caar",
"msp",
"isp",
"tc",
"itt0",
"itt1",
"dtt0",
41 "dtt1",
"mmusr",
"urp",
"srp",
43 "fpcr",
"fpsr",
"fpiar",
48 "abcd",
"add",
"adda",
"addi",
"addq",
"addx",
"and",
"andi",
"asl",
"asr",
"bhs",
"blo",
"bhi",
"bls",
"bcc",
"bcs",
"bne",
"beq",
"bvc",
49 "bvs",
"bpl",
"bmi",
"bge",
"blt",
"bgt",
"ble",
"bra",
"bsr",
"bchg",
"bclr",
"bset",
"btst",
"bfchg",
"bfclr",
"bfexts",
"bfextu",
"bfffo",
"bfins",
50 "bfset",
"bftst",
"bkpt",
"callm",
"cas",
"cas2",
"chk",
"chk2",
"clr",
"cmp",
"cmpa",
"cmpi",
"cmpm",
"cmp2",
"cinvl",
"cinvp",
"cinva",
"cpushl",
"cpushp",
51 "cpusha",
"dbt",
"dbf",
"dbhi",
"dbls",
"dbcc",
"dbcs",
"dbne",
"dbeq",
"dbvc",
"dbvs",
"dbpl",
"dbmi",
"dbge",
"dblt",
"dbgt",
"dble",
"dbra",
52 "divs",
"divsl",
"divu",
"divul",
"eor",
"eori",
"exg",
"ext",
"extb",
"fabs",
"fsabs",
"fdabs",
"facos",
"fadd",
"fsadd",
"fdadd",
"fasin",
53 "fatan",
"fatanh",
"fbf",
"fbeq",
"fbogt",
"fboge",
"fbolt",
"fbole",
"fbogl",
"fbor",
"fbun",
"fbueq",
"fbugt",
"fbuge",
"fbult",
"fbule",
"fbne",
"fbt",
54 "fbsf",
"fbseq",
"fbgt",
"fbge",
"fblt",
"fble",
"fbgl",
"fbgle",
"fbngle",
"fbngl",
"fbnle",
"fbnlt",
"fbnge",
"fbngt",
"fbsne",
"fbst",
"fcmp",
"fcos",
55 "fcosh",
"fdbf",
"fdbeq",
"fdbogt",
"fdboge",
"fdbolt",
"fdbole",
"fdbogl",
"fdbor",
"fdbun",
"fdbueq",
"fdbugt",
"fdbuge",
"fdbult",
"fdbule",
"fdbne",
56 "fdbt",
"fdbsf",
"fdbseq",
"fdbgt",
"fdbge",
"fdblt",
"fdble",
"fdbgl",
"fdbgle",
"fdbngle",
"fdbngl",
"fdbnle",
"fdbnlt",
"fdbnge",
"fdbngt",
"fdbsne",
57 "fdbst",
"fdiv",
"fsdiv",
"fddiv",
"fetox",
"fetoxm1",
"fgetexp",
"fgetman",
"fint",
"fintrz",
"flog10",
"flog2",
"flogn",
"flognp1",
"fmod",
"fmove",
58 "fsmove",
"fdmove",
"fmovecr",
"fmovem",
"fmul",
"fsmul",
"fdmul",
"fneg",
"fsneg",
"fdneg",
"fnop",
"frem",
"frestore",
"fsave",
"fscale",
"fsgldiv",
59 "fsglmul",
"fsin",
"fsincos",
"fsinh",
"fsqrt",
"fssqrt",
"fdsqrt",
"fsf",
"fseq",
"fsogt",
"fsoge",
"fsolt",
"fsole",
"fsogl",
"fsor",
"fsun",
"fsueq",
60 "fsugt",
"fsuge",
"fsult",
"fsule",
"fsne",
"fst",
"fssf",
"fsseq",
"fsgt",
"fsge",
"fslt",
"fsle",
"fsgl",
"fsgle",
"fsngle",
61 "fsngl",
"fsnle",
"fsnlt",
"fsnge",
"fsngt",
"fssne",
"fsst",
"fsub",
"fssub",
"fdsub",
"ftan",
"ftanh",
"ftentox",
"ftrapf",
"ftrapeq",
"ftrapogt",
62 "ftrapoge",
"ftrapolt",
"ftrapole",
"ftrapogl",
"ftrapor",
"ftrapun",
"ftrapueq",
"ftrapugt",
"ftrapuge",
"ftrapult",
"ftrapule",
"ftrapne",
"ftrapt",
63 "ftrapsf",
"ftrapseq",
"ftrapgt",
"ftrapge",
"ftraplt",
"ftraple",
"ftrapgl",
"ftrapgle",
"ftrapngle",
"ftrapngl",
"ftrapnle",
"ftrapnlt",
"ftrapnge",
64 "ftrapngt",
"ftrapsne",
"ftrapst",
"ftst",
"ftwotox",
"halt",
"illegal",
"jmp",
"jsr",
"lea",
"link",
"lpstop",
"lsl",
"lsr",
"move",
"movea",
"movec",
65 "movem",
"movep",
"moveq",
"moves",
"move16",
"muls",
"mulu",
"nbcd",
"neg",
"negx",
"nop",
"not",
"or",
"ori",
"pack",
"pea",
"pflush",
"pflusha",
66 "pflushan",
"pflushn",
"ploadr",
"ploadw",
"plpar",
"plpaw",
"pmove",
"pmovefd",
"ptestr",
"ptestw",
"pulse",
"rems",
"remu",
"reset",
"rol",
"ror",
67 "roxl",
"roxr",
"rtd",
"rte",
"rtm",
"rtr",
"rts",
"sbcd",
"st",
"sf",
"shi",
"sls",
"scc",
"shs",
"scs",
"slo",
"sne",
"seq",
"svc",
"svs",
"spl",
"smi",
68 "sge",
"slt",
"sgt",
"sle",
"stop",
"sub",
"suba",
"subi",
"subq",
"subx",
"swap",
"tas",
"trap",
"trapv",
"trapt",
"trapf",
"traphi",
"trapls",
69 "trapcc",
"traphs",
"trapcs",
"traplo",
"trapne",
"trapeq",
"trapvc",
"trapvs",
"trappl",
"trapmi",
"trapge",
"traplt",
"trapgt",
"traple",
"tst",
"unlk",
"unpk",
82 unsigned int first = 0;
83 unsigned int run_length = 0;
86 for (
i = 0;
i < 8; ++
i) {
87 if (data & (1 <<
i)) {
91 while (
i < 7 && (data & (1 << (
i + 1)))) {
109 unsigned int data =
op->register_bits;
133 switch (
op->address_mode) {
161 #if defined(_KERNEL_MODE)
189 if (
op->mem.in_disp > 0)
203 if (
op->mem.scale > 0)
220 if (
op->mem.in_disp > 0)
225 if (
op->mem.in_disp > 0)
237 if (
op->mem.scale > 0)
243 if (
op->mem.out_disp > 0)
254 if (
op->mem.bitfield)
259 #define m68k_sizeof_array(array) (int)(sizeof(array)/sizeof(array[0]))
260 #define m68k_min(a, b) (a < b) ? a : b
264 #ifndef CAPSTONE_DIET
279 detail->regs_read_count = regs_read_count;
282 detail->regs_write_count = regs_write_count;
285 detail->groups_count = groups_count;
298 switch (
ext->op_size.type) {
303 switch (
ext->op_size.cpu_size) {
312 switch (
ext->op_size.fpu_size) {
326 int reg_value_0, reg_value_1;
329 reg_value_0 =
ext->operands[2].register_bits >> 4;
330 reg_value_1 =
ext->operands[2].register_bits & 0xf;
335 for (
i = 0;
i <
ext->op_count; ++
i) {
337 if ((
i + 1) !=
ext->op_count)
369 #ifndef CAPSTONE_DIET
381 #ifndef CAPSTONE_DIET
static const char * s_instruction_names[]
const char * M68K_reg_name(csh handle, unsigned int reg)
static name_map group_name_maps[]
static const char * s_reg_names[]
static void registerPair(SStream *O, const cs_m68k_op *op)
const char * M68K_group_name(csh handle, unsigned int id)
static const char * s_spacing
const char * M68K_insn_name(csh handle, unsigned int id)
static void registerBits(SStream *O, const cs_m68k_op *op)
#define m68k_sizeof_array(array)
void M68K_get_insn_id(cs_struct *h, cs_insn *insn, unsigned int id)
static void printAddressingMode(SStream *O, unsigned int pc, const cs_m68k *inst, const cs_m68k_op *op)
void M68K_printInst(MCInst *MI, SStream *O, void *PrinterInfo)
static void printRegbitsRange(char *buffer, uint32_t data, const char *prefix)
static const char * getRegName(m68k_reg reg)
void SStream_concat(SStream *ss, const char *fmt,...)
void SStream_concat0(SStream *ss, const char *s)
static mcore_handle handle
RzBinInfo * info(RzBinFile *bf)
unsigned short prefix[65536]
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
@ M68K_CPU_SIZE_LONG
4 bytes in size
@ M68K_CPU_SIZE_WORD
2 bytes in size
@ M68K_CPU_SIZE_BYTE
1 byte in size
@ M68K_CPU_SIZE_NONE
unsized or unspecified
@ M68K_AM_NONE
No address mode.
@ M68K_AM_MEMI_POST_INDEX
Memory indirect - Postindex.
@ M68K_AM_PC_MEMI_PRE_INDEX
Program Counter Memory Indirect - Preindexed.
@ M68K_AM_REG_DIRECT_ADDR
Register Direct - Address.
@ M68K_AM_REGI_ADDR
Register Indirect - Address.
@ M68K_AM_IMMEDIATE
Immediate value.
@ M68K_AM_REGI_ADDR_POST_INC
Register Indirect - Address with Postincrement.
@ M68K_AM_ABSOLUTE_DATA_SHORT
Absolute Data Addressing - Short.
@ M68K_AM_AREGI_INDEX_8_BIT_DISP
Address Register Indirect With Index- 8-bit displacement.
@ M68K_AM_PCI_INDEX_BASE_DISP
Program Counter Indirect with Index - with Base Displacement.
@ M68K_AM_PCI_DISP
Program Counter Indirect - with Displacement.
@ M68K_AM_REGI_ADDR_PRE_DEC
Register Indirect - Address with Predecrement.
@ M68K_AM_MEMI_PRE_INDEX
Memory indirect - Preindex.
@ M68K_AM_ABSOLUTE_DATA_LONG
Absolute Data Addressing - Long.
@ M68K_AM_PC_MEMI_POST_INDEX
Program Counter Memory Indirect - Postindexed.
@ M68K_AM_REG_DIRECT_DATA
Register Direct - Data.
@ M68K_AM_AREGI_INDEX_BASE_DISP
Address Register Indirect With Index- Base displacement.
@ M68K_AM_BRANCH_DISPLACEMENT
Address as displacement from (PC+2) used by branches.
@ M68K_AM_PCI_INDEX_8_BIT_DISP
Program Counter Indirect with Index - with 8-Bit Displacement.
@ M68K_AM_REGI_ADDR_DISP
Register Indirect - Address with Displacement.
@ M68K_GRP_RET
= CS_GRP_RET
@ M68K_GRP_INVALID
CS_GRUP_INVALID.
@ M68K_GRP_IRET
= CS_GRP_IRET
@ M68K_GRP_JUMP
= CS_GRP_JUMP
@ M68K_GRP_BRANCH_RELATIVE
= CS_GRP_BRANCH_RELATIVE
@ M68K_OP_REG_PAIR
Register pair in the same op (upper 4 bits for first reg, lower for second)
@ M68K_OP_REG_BITS
Register bits move.
@ M68K_OP_REG
= CS_OP_REG (Register operand).
@ M68K_FPU_SIZE_SINGLE
4 byte in size (single float)
@ M68K_FPU_SIZE_NONE
unsized like fsave/frestore
@ M68K_FPU_SIZE_DOUBLE
8 byte in size (double)
@ M68K_FPU_SIZE_EXTENDED
12 byte in size (extended real format)
m68k_reg
M68K registers and special registers.
The M68K instruction and it's operands.
m68k_op_size op_size
size of data operand works on in bytes (.b, .w, .l, etc)
const char * id2name(const name_map *map, int max, const unsigned int id)