crabstone 3.0.3 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGES.md +45 -42
- data/README.md +16 -33
- data/lib/crabstone.rb +5 -557
- data/lib/crabstone/arch.rb +37 -0
- data/lib/{arch → crabstone/arch/3}/arm.rb +28 -49
- data/lib/crabstone/arch/3/arm64.rb +124 -0
- data/lib/{arch → crabstone/arch/3}/arm64_const.rb +45 -86
- data/lib/{arch → crabstone/arch/3}/arm_const.rb +19 -47
- data/lib/crabstone/arch/3/mips.rb +57 -0
- data/lib/{arch → crabstone/arch/3}/mips_const.rb +18 -38
- data/lib/crabstone/arch/3/ppc.rb +73 -0
- data/lib/{arch → crabstone/arch/3}/ppc_const.rb +27 -43
- data/lib/crabstone/arch/3/sparc.rb +60 -0
- data/lib/{arch → crabstone/arch/3}/sparc_const.rb +49 -67
- data/lib/crabstone/arch/3/sysz.rb +67 -0
- data/lib/{arch → crabstone/arch/3}/sysz_const.rb +11 -25
- data/lib/crabstone/arch/3/x86.rb +82 -0
- data/lib/{arch → crabstone/arch/3}/x86_const.rb +15 -36
- data/lib/crabstone/arch/3/xcore.rb +59 -0
- data/lib/{arch → crabstone/arch/3}/xcore_const.rb +10 -22
- data/lib/crabstone/arch/4/arm.rb +110 -0
- data/lib/crabstone/arch/4/arm64.rb +125 -0
- data/lib/crabstone/arch/4/arm64_const.rb +1016 -0
- data/lib/crabstone/arch/4/arm_const.rb +785 -0
- data/lib/crabstone/arch/4/evm.rb +20 -0
- data/lib/crabstone/arch/4/evm_const.rb +161 -0
- data/lib/crabstone/arch/4/m680x.rb +106 -0
- data/lib/crabstone/arch/4/m680x_const.rb +426 -0
- data/lib/crabstone/arch/4/m68k.rb +129 -0
- data/lib/crabstone/arch/4/m68k_const.rb +496 -0
- data/lib/crabstone/arch/4/mips.rb +57 -0
- data/lib/crabstone/arch/4/mips_const.rb +869 -0
- data/lib/crabstone/arch/4/ppc.rb +73 -0
- data/lib/crabstone/arch/4/ppc_const.rb +1375 -0
- data/lib/crabstone/arch/4/sparc.rb +60 -0
- data/lib/crabstone/arch/4/sparc_const.rb +439 -0
- data/lib/crabstone/arch/4/sysz.rb +67 -0
- data/lib/crabstone/arch/4/sysz_const.rb +763 -0
- data/lib/crabstone/arch/4/tms320c64x.rb +87 -0
- data/lib/crabstone/arch/4/tms320c64x_const.rb +287 -0
- data/lib/crabstone/arch/4/x86.rb +91 -0
- data/lib/crabstone/arch/4/x86_const.rb +1972 -0
- data/lib/crabstone/arch/4/xcore.rb +59 -0
- data/lib/crabstone/arch/4/xcore_const.rb +171 -0
- data/lib/crabstone/arch/extension.rb +27 -0
- data/lib/crabstone/arch/register.rb +36 -0
- data/lib/crabstone/binding.rb +60 -0
- data/lib/crabstone/binding/3/detail.rb +36 -0
- data/lib/crabstone/binding/3/instruction.rb +23 -0
- data/lib/crabstone/binding/4/detail.rb +40 -0
- data/lib/crabstone/binding/4/instruction.rb +23 -0
- data/lib/crabstone/binding/structs.rb +32 -0
- data/lib/crabstone/constants.rb +110 -0
- data/lib/crabstone/cs_version.rb +49 -0
- data/lib/crabstone/disassembler.rb +153 -0
- data/lib/crabstone/error.rb +60 -0
- data/lib/crabstone/instruction.rb +183 -0
- data/lib/crabstone/version.rb +5 -0
- metadata +128 -324
- data/MANIFEST +0 -312
- data/Rakefile +0 -27
- data/bin/genconst +0 -66
- data/bin/genreg +0 -99
- data/crabstone.gemspec +0 -27
- data/examples/hello_world.rb +0 -43
- data/lib/arch/arm64.rb +0 -167
- data/lib/arch/arm64_registers.rb +0 -295
- data/lib/arch/arm_registers.rb +0 -149
- data/lib/arch/mips.rb +0 -78
- data/lib/arch/mips_registers.rb +0 -208
- data/lib/arch/ppc.rb +0 -90
- data/lib/arch/ppc_registers.rb +0 -209
- data/lib/arch/sparc.rb +0 -79
- data/lib/arch/sparc_registers.rb +0 -121
- data/lib/arch/systemz.rb +0 -79
- data/lib/arch/sysz_registers.rb +0 -66
- data/lib/arch/x86.rb +0 -107
- data/lib/arch/x86_registers.rb +0 -265
- data/lib/arch/xcore.rb +0 -78
- data/lib/arch/xcore_registers.rb +0 -57
- data/test/MC/AArch64/basic-a64-instructions.s.cs +0 -2014
- data/test/MC/AArch64/gicv3-regs.s.cs +0 -111
- data/test/MC/AArch64/neon-2velem.s.cs +0 -113
- data/test/MC/AArch64/neon-3vdiff.s.cs +0 -143
- data/test/MC/AArch64/neon-aba-abd.s.cs +0 -28
- data/test/MC/AArch64/neon-across.s.cs +0 -40
- data/test/MC/AArch64/neon-add-pairwise.s.cs +0 -11
- data/test/MC/AArch64/neon-add-sub-instructions.s.cs +0 -21
- data/test/MC/AArch64/neon-bitwise-instructions.s.cs +0 -17
- data/test/MC/AArch64/neon-compare-instructions.s.cs +0 -136
- data/test/MC/AArch64/neon-crypto.s.cs +0 -15
- data/test/MC/AArch64/neon-extract.s.cs +0 -3
- data/test/MC/AArch64/neon-facge-facgt.s.cs +0 -13
- data/test/MC/AArch64/neon-frsqrt-frecp.s.cs +0 -7
- data/test/MC/AArch64/neon-halving-add-sub.s.cs +0 -25
- data/test/MC/AArch64/neon-max-min-pairwise.s.cs +0 -37
- data/test/MC/AArch64/neon-max-min.s.cs +0 -37
- data/test/MC/AArch64/neon-mla-mls-instructions.s.cs +0 -19
- data/test/MC/AArch64/neon-mov.s.cs +0 -74
- data/test/MC/AArch64/neon-mul-div-instructions.s.cs +0 -24
- data/test/MC/AArch64/neon-perm.s.cs +0 -43
- data/test/MC/AArch64/neon-rounding-halving-add.s.cs +0 -13
- data/test/MC/AArch64/neon-rounding-shift.s.cs +0 -15
- data/test/MC/AArch64/neon-saturating-add-sub.s.cs +0 -29
- data/test/MC/AArch64/neon-saturating-rounding-shift.s.cs +0 -15
- data/test/MC/AArch64/neon-saturating-shift.s.cs +0 -15
- data/test/MC/AArch64/neon-scalar-abs.s.cs +0 -8
- data/test/MC/AArch64/neon-scalar-add-sub.s.cs +0 -3
- data/test/MC/AArch64/neon-scalar-by-elem-mla.s.cs +0 -13
- data/test/MC/AArch64/neon-scalar-by-elem-mul.s.cs +0 -13
- data/test/MC/AArch64/neon-scalar-by-elem-saturating-mla.s.cs +0 -15
- data/test/MC/AArch64/neon-scalar-by-elem-saturating-mul.s.cs +0 -18
- data/test/MC/AArch64/neon-scalar-compare.s.cs +0 -12
- data/test/MC/AArch64/neon-scalar-cvt.s.cs +0 -34
- data/test/MC/AArch64/neon-scalar-dup.s.cs +0 -23
- data/test/MC/AArch64/neon-scalar-extract-narrow.s.cs +0 -10
- data/test/MC/AArch64/neon-scalar-fp-compare.s.cs +0 -21
- data/test/MC/AArch64/neon-scalar-mul.s.cs +0 -13
- data/test/MC/AArch64/neon-scalar-neg.s.cs +0 -6
- data/test/MC/AArch64/neon-scalar-recip.s.cs +0 -11
- data/test/MC/AArch64/neon-scalar-reduce-pairwise.s.cs +0 -3
- data/test/MC/AArch64/neon-scalar-rounding-shift.s.cs +0 -3
- data/test/MC/AArch64/neon-scalar-saturating-add-sub.s.cs +0 -25
- data/test/MC/AArch64/neon-scalar-saturating-rounding-shift.s.cs +0 -9
- data/test/MC/AArch64/neon-scalar-saturating-shift.s.cs +0 -9
- data/test/MC/AArch64/neon-scalar-shift-imm.s.cs +0 -42
- data/test/MC/AArch64/neon-scalar-shift.s.cs +0 -3
- data/test/MC/AArch64/neon-shift-left-long.s.cs +0 -13
- data/test/MC/AArch64/neon-shift.s.cs +0 -22
- data/test/MC/AArch64/neon-simd-copy.s.cs +0 -42
- data/test/MC/AArch64/neon-simd-ldst-multi-elem.s.cs +0 -197
- data/test/MC/AArch64/neon-simd-ldst-one-elem.s.cs +0 -129
- data/test/MC/AArch64/neon-simd-misc.s.cs +0 -213
- data/test/MC/AArch64/neon-simd-post-ldst-multi-elem.s.cs +0 -107
- data/test/MC/AArch64/neon-simd-shift.s.cs +0 -151
- data/test/MC/AArch64/neon-tbl.s.cs +0 -21
- data/test/MC/AArch64/trace-regs.s.cs +0 -383
- data/test/MC/ARM/arm-aliases.s.cs +0 -7
- data/test/MC/ARM/arm-arithmetic-aliases.s.cs +0 -50
- data/test/MC/ARM/arm-it-block.s.cs +0 -2
- data/test/MC/ARM/arm-memory-instructions.s.cs +0 -138
- data/test/MC/ARM/arm-shift-encoding.s.cs +0 -50
- data/test/MC/ARM/arm-thumb-trustzone.s.cs +0 -3
- data/test/MC/ARM/arm-trustzone.s.cs +0 -3
- data/test/MC/ARM/arm_addrmode2.s.cs +0 -15
- data/test/MC/ARM/arm_addrmode3.s.cs +0 -9
- data/test/MC/ARM/arm_instructions.s.cs +0 -25
- data/test/MC/ARM/basic-arm-instructions-v8.s.cs +0 -10
- data/test/MC/ARM/basic-arm-instructions.s.cs +0 -997
- data/test/MC/ARM/basic-thumb-instructions.s.cs +0 -130
- data/test/MC/ARM/basic-thumb2-instructions-v8.s.cs +0 -1
- data/test/MC/ARM/basic-thumb2-instructions.s.cs +0 -1242
- data/test/MC/ARM/crc32-thumb.s.cs +0 -7
- data/test/MC/ARM/crc32.s.cs +0 -7
- data/test/MC/ARM/dot-req.s.cs +0 -3
- data/test/MC/ARM/fp-armv8.s.cs +0 -52
- data/test/MC/ARM/idiv-thumb.s.cs +0 -3
- data/test/MC/ARM/idiv.s.cs +0 -3
- data/test/MC/ARM/load-store-acquire-release-v8-thumb.s.cs +0 -15
- data/test/MC/ARM/load-store-acquire-release-v8.s.cs +0 -15
- data/test/MC/ARM/mode-switch.s.cs +0 -7
- data/test/MC/ARM/neon-abs-encoding.s.cs +0 -15
- data/test/MC/ARM/neon-absdiff-encoding.s.cs +0 -39
- data/test/MC/ARM/neon-add-encoding.s.cs +0 -119
- data/test/MC/ARM/neon-bitcount-encoding.s.cs +0 -15
- data/test/MC/ARM/neon-bitwise-encoding.s.cs +0 -126
- data/test/MC/ARM/neon-cmp-encoding.s.cs +0 -88
- data/test/MC/ARM/neon-convert-encoding.s.cs +0 -27
- data/test/MC/ARM/neon-crypto.s.cs +0 -16
- data/test/MC/ARM/neon-dup-encoding.s.cs +0 -13
- data/test/MC/ARM/neon-minmax-encoding.s.cs +0 -57
- data/test/MC/ARM/neon-mov-encoding.s.cs +0 -76
- data/test/MC/ARM/neon-mul-accum-encoding.s.cs +0 -39
- data/test/MC/ARM/neon-mul-encoding.s.cs +0 -72
- data/test/MC/ARM/neon-neg-encoding.s.cs +0 -15
- data/test/MC/ARM/neon-pairwise-encoding.s.cs +0 -47
- data/test/MC/ARM/neon-reciprocal-encoding.s.cs +0 -13
- data/test/MC/ARM/neon-reverse-encoding.s.cs +0 -13
- data/test/MC/ARM/neon-satshift-encoding.s.cs +0 -75
- data/test/MC/ARM/neon-shift-encoding.s.cs +0 -238
- data/test/MC/ARM/neon-shiftaccum-encoding.s.cs +0 -97
- data/test/MC/ARM/neon-shuffle-encoding.s.cs +0 -59
- data/test/MC/ARM/neon-sub-encoding.s.cs +0 -82
- data/test/MC/ARM/neon-table-encoding.s.cs +0 -9
- data/test/MC/ARM/neon-v8.s.cs +0 -38
- data/test/MC/ARM/neon-vld-encoding.s.cs +0 -213
- data/test/MC/ARM/neon-vst-encoding.s.cs +0 -120
- data/test/MC/ARM/neon-vswp.s.cs +0 -3
- data/test/MC/ARM/neont2-abs-encoding.s.cs +0 -15
- data/test/MC/ARM/neont2-absdiff-encoding.s.cs +0 -39
- data/test/MC/ARM/neont2-add-encoding.s.cs +0 -65
- data/test/MC/ARM/neont2-bitcount-encoding.s.cs +0 -15
- data/test/MC/ARM/neont2-bitwise-encoding.s.cs +0 -15
- data/test/MC/ARM/neont2-cmp-encoding.s.cs +0 -17
- data/test/MC/ARM/neont2-convert-encoding.s.cs +0 -19
- data/test/MC/ARM/neont2-dup-encoding.s.cs +0 -19
- data/test/MC/ARM/neont2-minmax-encoding.s.cs +0 -57
- data/test/MC/ARM/neont2-mov-encoding.s.cs +0 -58
- data/test/MC/ARM/neont2-mul-accum-encoding.s.cs +0 -41
- data/test/MC/ARM/neont2-mul-encoding.s.cs +0 -31
- data/test/MC/ARM/neont2-neg-encoding.s.cs +0 -15
- data/test/MC/ARM/neont2-pairwise-encoding.s.cs +0 -43
- data/test/MC/ARM/neont2-reciprocal-encoding.s.cs +0 -13
- data/test/MC/ARM/neont2-reverse-encoding.s.cs +0 -13
- data/test/MC/ARM/neont2-satshift-encoding.s.cs +0 -75
- data/test/MC/ARM/neont2-shift-encoding.s.cs +0 -80
- data/test/MC/ARM/neont2-shiftaccum-encoding.s.cs +0 -97
- data/test/MC/ARM/neont2-shuffle-encoding.s.cs +0 -23
- data/test/MC/ARM/neont2-sub-encoding.s.cs +0 -23
- data/test/MC/ARM/neont2-table-encoding.s.cs +0 -9
- data/test/MC/ARM/neont2-vld-encoding.s.cs +0 -51
- data/test/MC/ARM/neont2-vst-encoding.s.cs +0 -48
- data/test/MC/ARM/simple-fp-encoding.s.cs +0 -157
- data/test/MC/ARM/thumb-fp-armv8.s.cs +0 -51
- data/test/MC/ARM/thumb-hints.s.cs +0 -12
- data/test/MC/ARM/thumb-neon-crypto.s.cs +0 -16
- data/test/MC/ARM/thumb-neon-v8.s.cs +0 -38
- data/test/MC/ARM/thumb-shift-encoding.s.cs +0 -19
- data/test/MC/ARM/thumb.s.cs +0 -19
- data/test/MC/ARM/thumb2-b.w-encodingT4.s.cs +0 -2
- data/test/MC/ARM/thumb2-branches.s.cs +0 -85
- data/test/MC/ARM/thumb2-mclass.s.cs +0 -41
- data/test/MC/ARM/thumb2-narrow-dp.ll.cs +0 -379
- data/test/MC/ARM/thumb2-pldw.s.cs +0 -2
- data/test/MC/ARM/vfp4-thumb.s.cs +0 -13
- data/test/MC/ARM/vfp4.s.cs +0 -13
- data/test/MC/ARM/vpush-vpop-thumb.s.cs +0 -9
- data/test/MC/ARM/vpush-vpop.s.cs +0 -9
- data/test/MC/Mips/hilo-addressing.s.cs +0 -4
- data/test/MC/Mips/micromips-alu-instructions-EB.s.cs +0 -33
- data/test/MC/Mips/micromips-alu-instructions.s.cs +0 -33
- data/test/MC/Mips/micromips-branch-instructions-EB.s.cs +0 -11
- data/test/MC/Mips/micromips-branch-instructions.s.cs +0 -11
- data/test/MC/Mips/micromips-expansions.s.cs +0 -20
- data/test/MC/Mips/micromips-jump-instructions-EB.s.cs +0 -5
- data/test/MC/Mips/micromips-jump-instructions.s.cs +0 -6
- data/test/MC/Mips/micromips-loadstore-instructions-EB.s.cs +0 -9
- data/test/MC/Mips/micromips-loadstore-instructions.s.cs +0 -9
- data/test/MC/Mips/micromips-loadstore-unaligned-EB.s.cs +0 -5
- data/test/MC/Mips/micromips-loadstore-unaligned.s.cs +0 -5
- data/test/MC/Mips/micromips-movcond-instructions-EB.s.cs +0 -5
- data/test/MC/Mips/micromips-movcond-instructions.s.cs +0 -5
- data/test/MC/Mips/micromips-multiply-instructions-EB.s.cs +0 -5
- data/test/MC/Mips/micromips-multiply-instructions.s.cs +0 -5
- data/test/MC/Mips/micromips-shift-instructions-EB.s.cs +0 -9
- data/test/MC/Mips/micromips-shift-instructions.s.cs +0 -9
- data/test/MC/Mips/micromips-trap-instructions-EB.s.cs +0 -13
- data/test/MC/Mips/micromips-trap-instructions.s.cs +0 -13
- data/test/MC/Mips/mips-alu-instructions.s.cs +0 -53
- data/test/MC/Mips/mips-control-instructions-64.s.cs +0 -33
- data/test/MC/Mips/mips-control-instructions.s.cs +0 -33
- data/test/MC/Mips/mips-coprocessor-encodings.s.cs +0 -17
- data/test/MC/Mips/mips-dsp-instructions.s.cs +0 -43
- data/test/MC/Mips/mips-expansions.s.cs +0 -20
- data/test/MC/Mips/mips-fpu-instructions.s.cs +0 -93
- data/test/MC/Mips/mips-jump-instructions.s.cs +0 -1
- data/test/MC/Mips/mips-memory-instructions.s.cs +0 -17
- data/test/MC/Mips/mips-register-names.s.cs +0 -33
- data/test/MC/Mips/mips64-alu-instructions.s.cs +0 -47
- data/test/MC/Mips/mips64-instructions.s.cs +0 -3
- data/test/MC/Mips/mips64-register-names.s.cs +0 -33
- data/test/MC/Mips/mips_directives.s.cs +0 -12
- data/test/MC/Mips/nabi-regs.s.cs +0 -12
- data/test/MC/Mips/set-at-directive.s.cs +0 -6
- data/test/MC/Mips/test_2r.s.cs +0 -16
- data/test/MC/Mips/test_2rf.s.cs +0 -33
- data/test/MC/Mips/test_3r.s.cs +0 -243
- data/test/MC/Mips/test_3rf.s.cs +0 -83
- data/test/MC/Mips/test_bit.s.cs +0 -49
- data/test/MC/Mips/test_cbranch.s.cs +0 -11
- data/test/MC/Mips/test_ctrlregs.s.cs +0 -33
- data/test/MC/Mips/test_elm.s.cs +0 -16
- data/test/MC/Mips/test_elm_insert.s.cs +0 -4
- data/test/MC/Mips/test_elm_insve.s.cs +0 -5
- data/test/MC/Mips/test_i10.s.cs +0 -5
- data/test/MC/Mips/test_i5.s.cs +0 -45
- data/test/MC/Mips/test_i8.s.cs +0 -11
- data/test/MC/Mips/test_lsa.s.cs +0 -5
- data/test/MC/Mips/test_mi10.s.cs +0 -24
- data/test/MC/Mips/test_vec.s.cs +0 -8
- data/test/MC/PowerPC/ppc64-encoding-bookII.s.cs +0 -25
- data/test/MC/PowerPC/ppc64-encoding-bookIII.s.cs +0 -35
- data/test/MC/PowerPC/ppc64-encoding-ext.s.cs +0 -535
- data/test/MC/PowerPC/ppc64-encoding-fp.s.cs +0 -110
- data/test/MC/PowerPC/ppc64-encoding-vmx.s.cs +0 -170
- data/test/MC/PowerPC/ppc64-encoding.s.cs +0 -202
- data/test/MC/PowerPC/ppc64-operands.s.cs +0 -32
- data/test/MC/README +0 -6
- data/test/MC/Sparc/sparc-alu-instructions.s.cs +0 -47
- data/test/MC/Sparc/sparc-atomic-instructions.s.cs +0 -7
- data/test/MC/Sparc/sparc-ctrl-instructions.s.cs +0 -11
- data/test/MC/Sparc/sparc-fp-instructions.s.cs +0 -59
- data/test/MC/Sparc/sparc-mem-instructions.s.cs +0 -25
- data/test/MC/Sparc/sparc-vis.s.cs +0 -2
- data/test/MC/Sparc/sparc64-alu-instructions.s.cs +0 -13
- data/test/MC/Sparc/sparc64-ctrl-instructions.s.cs +0 -102
- data/test/MC/Sparc/sparcv8-instructions.s.cs +0 -7
- data/test/MC/Sparc/sparcv9-instructions.s.cs +0 -1
- data/test/MC/SystemZ/insn-good-z196.s.cs +0 -589
- data/test/MC/SystemZ/insn-good.s.cs +0 -2265
- data/test/MC/SystemZ/regs-good.s.cs +0 -45
- data/test/MC/X86/3DNow.s.cs +0 -29
- data/test/MC/X86/address-size.s.cs +0 -5
- data/test/MC/X86/avx512-encodings.s.cs +0 -12
- data/test/MC/X86/intel-syntax-encoding.s.cs +0 -30
- data/test/MC/X86/x86-32-avx.s.cs +0 -833
- data/test/MC/X86/x86-32-fma3.s.cs +0 -169
- data/test/MC/X86/x86-32-ms-inline-asm.s.cs +0 -27
- data/test/MC/X86/x86_64-avx-clmul-encoding.s.cs +0 -11
- data/test/MC/X86/x86_64-avx-encoding.s.cs +0 -1058
- data/test/MC/X86/x86_64-bmi-encoding.s.cs +0 -51
- data/test/MC/X86/x86_64-encoding.s.cs +0 -59
- data/test/MC/X86/x86_64-fma3-encoding.s.cs +0 -169
- data/test/MC/X86/x86_64-fma4-encoding.s.cs +0 -98
- data/test/MC/X86/x86_64-hle-encoding.s.cs +0 -3
- data/test/MC/X86/x86_64-imm-widths.s.cs +0 -27
- data/test/MC/X86/x86_64-rand-encoding.s.cs +0 -13
- data/test/MC/X86/x86_64-rtm-encoding.s.cs +0 -4
- data/test/MC/X86/x86_64-sse4a.s.cs +0 -1
- data/test/MC/X86/x86_64-tbm-encoding.s.cs +0 -40
- data/test/MC/X86/x86_64-xop-encoding.s.cs +0 -152
- data/test/README +0 -6
- data/test/test.rb +0 -205
- data/test/test.rb.SPEC +0 -235
- data/test/test_arm.rb +0 -202
- data/test/test_arm.rb.SPEC +0 -275
- data/test/test_arm64.rb +0 -150
- data/test/test_arm64.rb.SPEC +0 -116
- data/test/test_detail.rb +0 -228
- data/test/test_detail.rb.SPEC +0 -322
- data/test/test_exhaustive.rb +0 -80
- data/test/test_mips.rb +0 -118
- data/test/test_mips.rb.SPEC +0 -91
- data/test/test_ppc.rb +0 -137
- data/test/test_ppc.rb.SPEC +0 -84
- data/test/test_sanity.rb +0 -83
- data/test/test_skipdata.rb +0 -111
- data/test/test_skipdata.rb.SPEC +0 -58
- data/test/test_sparc.rb +0 -113
- data/test/test_sparc.rb.SPEC +0 -116
- data/test/test_sysz.rb +0 -111
- data/test/test_sysz.rb.SPEC +0 -61
- data/test/test_x86.rb +0 -189
- data/test/test_x86.rb.SPEC +0 -579
- data/test/test_xcore.rb +0 -100
- data/test/test_xcore.rb.SPEC +0 -75
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# THIS FILE WAS AUTO-GENERATED -- DO NOT EDIT!
|
4
|
+
|
5
|
+
require 'ffi'
|
6
|
+
|
7
|
+
require 'crabstone/arch/extension'
|
8
|
+
require_relative 'xcore_const'
|
9
|
+
|
10
|
+
module Crabstone
|
11
|
+
module XCore
|
12
|
+
class OperandMemory < FFI::Struct
|
13
|
+
layout(
|
14
|
+
:base, :uint8,
|
15
|
+
:index, :uint8,
|
16
|
+
:disp, :int,
|
17
|
+
:direct, :int
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
class OperandValue < FFI::Union
|
22
|
+
layout(
|
23
|
+
:reg, :uint,
|
24
|
+
:imm, :int,
|
25
|
+
:mem, OperandMemory
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
class Operand < FFI::Struct
|
30
|
+
layout(
|
31
|
+
:type, :uint,
|
32
|
+
:value, OperandValue
|
33
|
+
)
|
34
|
+
|
35
|
+
include Crabstone::Extension::Operand
|
36
|
+
|
37
|
+
def reg?
|
38
|
+
self[:type] == OP_REG
|
39
|
+
end
|
40
|
+
|
41
|
+
def imm?
|
42
|
+
self[:type] == OP_IMM
|
43
|
+
end
|
44
|
+
|
45
|
+
def mem?
|
46
|
+
self[:type] == OP_MEM
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
class Instruction < FFI::Struct
|
51
|
+
layout(
|
52
|
+
:op_count, :uint8,
|
53
|
+
:operands, [Operand, 8]
|
54
|
+
)
|
55
|
+
|
56
|
+
include Crabstone::Extension::Instruction
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,171 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# THIS FILE WAS AUTO-GENERATED -- DO NOT EDIT!
|
4
|
+
|
5
|
+
require 'crabstone/arch/register'
|
6
|
+
|
7
|
+
module Crabstone
|
8
|
+
module XCore
|
9
|
+
OP_INVALID = 0
|
10
|
+
OP_REG = 1
|
11
|
+
OP_IMM = 2
|
12
|
+
OP_MEM = 3
|
13
|
+
|
14
|
+
REG_INVALID = 0
|
15
|
+
REG_CP = 1
|
16
|
+
REG_DP = 2
|
17
|
+
REG_LR = 3
|
18
|
+
REG_SP = 4
|
19
|
+
REG_R0 = 5
|
20
|
+
REG_R1 = 6
|
21
|
+
REG_R2 = 7
|
22
|
+
REG_R3 = 8
|
23
|
+
REG_R4 = 9
|
24
|
+
REG_R5 = 10
|
25
|
+
REG_R6 = 11
|
26
|
+
REG_R7 = 12
|
27
|
+
REG_R8 = 13
|
28
|
+
REG_R9 = 14
|
29
|
+
REG_R10 = 15
|
30
|
+
REG_R11 = 16
|
31
|
+
REG_PC = 17
|
32
|
+
REG_SCP = 18
|
33
|
+
REG_SSR = 19
|
34
|
+
REG_ET = 20
|
35
|
+
REG_ED = 21
|
36
|
+
REG_SED = 22
|
37
|
+
REG_KEP = 23
|
38
|
+
REG_KSP = 24
|
39
|
+
REG_ID = 25
|
40
|
+
REG_ENDING = 26
|
41
|
+
|
42
|
+
INS_INVALID = 0
|
43
|
+
INS_ADD = 1
|
44
|
+
INS_ANDNOT = 2
|
45
|
+
INS_AND = 3
|
46
|
+
INS_ASHR = 4
|
47
|
+
INS_BAU = 5
|
48
|
+
INS_BITREV = 6
|
49
|
+
INS_BLA = 7
|
50
|
+
INS_BLAT = 8
|
51
|
+
INS_BL = 9
|
52
|
+
INS_BF = 10
|
53
|
+
INS_BT = 11
|
54
|
+
INS_BU = 12
|
55
|
+
INS_BRU = 13
|
56
|
+
INS_BYTEREV = 14
|
57
|
+
INS_CHKCT = 15
|
58
|
+
INS_CLRE = 16
|
59
|
+
INS_CLRPT = 17
|
60
|
+
INS_CLRSR = 18
|
61
|
+
INS_CLZ = 19
|
62
|
+
INS_CRC8 = 20
|
63
|
+
INS_CRC32 = 21
|
64
|
+
INS_DCALL = 22
|
65
|
+
INS_DENTSP = 23
|
66
|
+
INS_DGETREG = 24
|
67
|
+
INS_DIVS = 25
|
68
|
+
INS_DIVU = 26
|
69
|
+
INS_DRESTSP = 27
|
70
|
+
INS_DRET = 28
|
71
|
+
INS_ECALLF = 29
|
72
|
+
INS_ECALLT = 30
|
73
|
+
INS_EDU = 31
|
74
|
+
INS_EEF = 32
|
75
|
+
INS_EET = 33
|
76
|
+
INS_EEU = 34
|
77
|
+
INS_ENDIN = 35
|
78
|
+
INS_ENTSP = 36
|
79
|
+
INS_EQ = 37
|
80
|
+
INS_EXTDP = 38
|
81
|
+
INS_EXTSP = 39
|
82
|
+
INS_FREER = 40
|
83
|
+
INS_FREET = 41
|
84
|
+
INS_GETD = 42
|
85
|
+
INS_GET = 43
|
86
|
+
INS_GETN = 44
|
87
|
+
INS_GETR = 45
|
88
|
+
INS_GETSR = 46
|
89
|
+
INS_GETST = 47
|
90
|
+
INS_GETTS = 48
|
91
|
+
INS_INCT = 49
|
92
|
+
INS_INIT = 50
|
93
|
+
INS_INPW = 51
|
94
|
+
INS_INSHR = 52
|
95
|
+
INS_INT = 53
|
96
|
+
INS_IN = 54
|
97
|
+
INS_KCALL = 55
|
98
|
+
INS_KENTSP = 56
|
99
|
+
INS_KRESTSP = 57
|
100
|
+
INS_KRET = 58
|
101
|
+
INS_LADD = 59
|
102
|
+
INS_LD16S = 60
|
103
|
+
INS_LD8U = 61
|
104
|
+
INS_LDA16 = 62
|
105
|
+
INS_LDAP = 63
|
106
|
+
INS_LDAW = 64
|
107
|
+
INS_LDC = 65
|
108
|
+
INS_LDW = 66
|
109
|
+
INS_LDIVU = 67
|
110
|
+
INS_LMUL = 68
|
111
|
+
INS_LSS = 69
|
112
|
+
INS_LSUB = 70
|
113
|
+
INS_LSU = 71
|
114
|
+
INS_MACCS = 72
|
115
|
+
INS_MACCU = 73
|
116
|
+
INS_MJOIN = 74
|
117
|
+
INS_MKMSK = 75
|
118
|
+
INS_MSYNC = 76
|
119
|
+
INS_MUL = 77
|
120
|
+
INS_NEG = 78
|
121
|
+
INS_NOT = 79
|
122
|
+
INS_OR = 80
|
123
|
+
INS_OUTCT = 81
|
124
|
+
INS_OUTPW = 82
|
125
|
+
INS_OUTSHR = 83
|
126
|
+
INS_OUTT = 84
|
127
|
+
INS_OUT = 85
|
128
|
+
INS_PEEK = 86
|
129
|
+
INS_REMS = 87
|
130
|
+
INS_REMU = 88
|
131
|
+
INS_RETSP = 89
|
132
|
+
INS_SETCLK = 90
|
133
|
+
INS_SET = 91
|
134
|
+
INS_SETC = 92
|
135
|
+
INS_SETD = 93
|
136
|
+
INS_SETEV = 94
|
137
|
+
INS_SETN = 95
|
138
|
+
INS_SETPSC = 96
|
139
|
+
INS_SETPT = 97
|
140
|
+
INS_SETRDY = 98
|
141
|
+
INS_SETSR = 99
|
142
|
+
INS_SETTW = 100
|
143
|
+
INS_SETV = 101
|
144
|
+
INS_SEXT = 102
|
145
|
+
INS_SHL = 103
|
146
|
+
INS_SHR = 104
|
147
|
+
INS_SSYNC = 105
|
148
|
+
INS_ST16 = 106
|
149
|
+
INS_ST8 = 107
|
150
|
+
INS_STW = 108
|
151
|
+
INS_SUB = 109
|
152
|
+
INS_SYNCR = 110
|
153
|
+
INS_TESTCT = 111
|
154
|
+
INS_TESTLCL = 112
|
155
|
+
INS_TESTWCT = 113
|
156
|
+
INS_TSETMR = 114
|
157
|
+
INS_START = 115
|
158
|
+
INS_WAITEF = 116
|
159
|
+
INS_WAITET = 117
|
160
|
+
INS_WAITEU = 118
|
161
|
+
INS_XOR = 119
|
162
|
+
INS_ZEXT = 120
|
163
|
+
INS_ENDING = 121
|
164
|
+
|
165
|
+
GRP_INVALID = 0
|
166
|
+
GRP_JUMP = 1
|
167
|
+
GRP_ENDING = 2
|
168
|
+
|
169
|
+
extend Register
|
170
|
+
end
|
171
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Crabstone
|
4
|
+
# These modules is for +class Operand+ and +class Instruction+ to extend.
|
5
|
+
# @private
|
6
|
+
module Extension
|
7
|
+
# For +class Operand+.
|
8
|
+
module Operand
|
9
|
+
def value
|
10
|
+
self[:value].class.members.find do |s|
|
11
|
+
return self[:value][s] if __send__("#{s}?".to_sym)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def valid?
|
16
|
+
!value.nil?
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# For +class Instruction+.
|
21
|
+
module Instruction
|
22
|
+
def operands
|
23
|
+
self[:operands].take_while { |op| op[:type] != OP_INVALID }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'set'
|
4
|
+
|
5
|
+
module Crabstone
|
6
|
+
# Module for arch/<version>/<arch>_const.rb to extend.
|
7
|
+
module Register
|
8
|
+
# @param [Integer, String, Symbol] reg
|
9
|
+
# @return [Integer]
|
10
|
+
def register(reg)
|
11
|
+
if reg.is_a?(Integer)
|
12
|
+
value?(reg) ? reg : invalid
|
13
|
+
else
|
14
|
+
dict[reg.to_s.upcase] || invalid
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def dict
|
21
|
+
return @dict if defined?(@dict)
|
22
|
+
|
23
|
+
keys = constants.select { |k| k.to_s.start_with?('REG_') }
|
24
|
+
@dict = keys.map { |k| [k.to_s[4..-1], const_get(k)] }.to_h.freeze
|
25
|
+
end
|
26
|
+
|
27
|
+
def value?(val)
|
28
|
+
@val_set ||= Set.new(dict.values)
|
29
|
+
@val_set.member?(val)
|
30
|
+
end
|
31
|
+
|
32
|
+
def invalid
|
33
|
+
dict['INVALID']
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'crabstone/constants'
|
4
|
+
require 'crabstone/binding/structs'
|
5
|
+
|
6
|
+
module Crabstone
|
7
|
+
module Binding
|
8
|
+
class Instruction < FFI::ManagedStruct
|
9
|
+
def self.release(obj)
|
10
|
+
ptr = obj.pointer
|
11
|
+
detail_ptr = ptr.+(Instruction.offset_of(:detail)).read_pointer
|
12
|
+
Binding.free(detail_ptr)
|
13
|
+
Binding.free(ptr)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# These APIs still might be changed in a new Capstone version.
|
18
|
+
attach_function(
|
19
|
+
:cs_disasm,
|
20
|
+
%i[csh pointer size_t ulong_long size_t pointer],
|
21
|
+
:size_t
|
22
|
+
)
|
23
|
+
attach_function :cs_close, [:pointer], :cs_err
|
24
|
+
attach_function :cs_errno, [:csh], :cs_err
|
25
|
+
attach_function :cs_group_name, %i[csh uint], :string
|
26
|
+
attach_function :cs_insn_group, [:csh, Instruction, :uint], :bool
|
27
|
+
attach_function :cs_insn_name, %i[csh uint], :string
|
28
|
+
attach_function :cs_op_count, [:csh, Instruction, :uint], :cs_err
|
29
|
+
attach_function :cs_open, %i[cs_arch cs_mode pointer], :cs_err
|
30
|
+
attach_function :cs_option, %i[csh cs_opt_type cs_opt_value], :cs_err
|
31
|
+
attach_function :cs_reg_name, %i[csh uint], :string
|
32
|
+
attach_function :cs_reg_read, [:csh, Instruction, :uint], :bool
|
33
|
+
attach_function :cs_reg_write, [:csh, Instruction, :uint], :bool
|
34
|
+
attach_function :cs_strerror, [:cs_err], :string
|
35
|
+
attach_function :cs_support, [:cs_arch], :bool
|
36
|
+
# Already defined in cs_version.rb
|
37
|
+
# attach_function :cs_version, %i[pointer pointer], :uint
|
38
|
+
attach_function :memcpy, %i[pointer pointer size_t], :pointer
|
39
|
+
attach_function :malloc, [:size_t], :pointer
|
40
|
+
attach_function :free, [:pointer], :void
|
41
|
+
|
42
|
+
# Wrap to prevent function not found in elder Capstone.
|
43
|
+
def self.safe_attach(*args)
|
44
|
+
attach_function(*args)
|
45
|
+
rescue FFI::NotFoundError
|
46
|
+
end
|
47
|
+
|
48
|
+
# New APIs since Capstone 4.
|
49
|
+
safe_attach :cs_regs_access, [:csh, Instruction, :pointer, :pointer, :pointer, :pointer], :cs_err
|
50
|
+
end
|
51
|
+
|
52
|
+
# This is a C engine build option, so we can set it here, not when we
|
53
|
+
# instantiate a new Disassembler.
|
54
|
+
# Diet mode means:
|
55
|
+
# - No op_str or mnemonic in Instruction
|
56
|
+
# - No regs_read, regs_write or groups ( even with detail on )
|
57
|
+
# - No reg_name or insn_name id2str convenience functions
|
58
|
+
# - detail mode CAN still be on - so the arch insn operands MAY be available
|
59
|
+
DIET_MODE = Binding.cs_support(SUPPORT_DIET)
|
60
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# THIS FILE WAS AUTO-GENERATED -- DO NOT EDIT!
|
4
|
+
|
5
|
+
require 'ffi'
|
6
|
+
|
7
|
+
require 'crabstone/arch'
|
8
|
+
|
9
|
+
module Crabstone
|
10
|
+
module Binding
|
11
|
+
class Architecture < FFI::Union
|
12
|
+
layout(
|
13
|
+
:arm, ARM::Instruction,
|
14
|
+
:arm64, ARM64::Instruction,
|
15
|
+
:mips, MIPS::Instruction,
|
16
|
+
:ppc, PPC::Instruction,
|
17
|
+
:sparc, Sparc::Instruction,
|
18
|
+
:sysz, SysZ::Instruction,
|
19
|
+
:x86, X86::Instruction,
|
20
|
+
:xcore, XCore::Instruction
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
class Detail < FFI::Struct
|
25
|
+
layout(
|
26
|
+
:regs_read, [:uint8, 12],
|
27
|
+
:regs_read_count, :uint8,
|
28
|
+
:regs_write, [:uint8, 20],
|
29
|
+
:regs_write_count, :uint8,
|
30
|
+
:groups, [:uint8, 8],
|
31
|
+
:groups_count, :uint8,
|
32
|
+
:arch, Architecture
|
33
|
+
)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# THIS FILE WAS AUTO-GENERATED -- DO NOT EDIT!
|
4
|
+
|
5
|
+
require 'ffi'
|
6
|
+
|
7
|
+
require_relative 'detail'
|
8
|
+
|
9
|
+
module Crabstone
|
10
|
+
module Binding
|
11
|
+
class Instruction < FFI::ManagedStruct
|
12
|
+
layout(
|
13
|
+
:id, :uint32,
|
14
|
+
:address, :uint64,
|
15
|
+
:size, :uint16,
|
16
|
+
:bytes, [:uint8, 16],
|
17
|
+
:mnemonic, [:char, 32],
|
18
|
+
:op_str, [:char, 160],
|
19
|
+
:detail, Detail.by_ref
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# THIS FILE WAS AUTO-GENERATED -- DO NOT EDIT!
|
4
|
+
|
5
|
+
require 'ffi'
|
6
|
+
|
7
|
+
require 'crabstone/arch'
|
8
|
+
|
9
|
+
module Crabstone
|
10
|
+
module Binding
|
11
|
+
class Architecture < FFI::Union
|
12
|
+
layout(
|
13
|
+
:arm, ARM::Instruction,
|
14
|
+
:arm64, ARM64::Instruction,
|
15
|
+
:evm, EVM::Instruction,
|
16
|
+
:m680x, M680X::Instruction,
|
17
|
+
:m68k, M68K::Instruction,
|
18
|
+
:mips, MIPS::Instruction,
|
19
|
+
:ppc, PPC::Instruction,
|
20
|
+
:sparc, Sparc::Instruction,
|
21
|
+
:sysz, SysZ::Instruction,
|
22
|
+
:tms320c64x, TMS320C64X::Instruction,
|
23
|
+
:x86, X86::Instruction,
|
24
|
+
:xcore, XCore::Instruction
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
class Detail < FFI::Struct
|
29
|
+
layout(
|
30
|
+
:regs_read, [:uint16, 12],
|
31
|
+
:regs_read_count, :uint8,
|
32
|
+
:regs_write, [:uint16, 20],
|
33
|
+
:regs_write_count, :uint8,
|
34
|
+
:groups, [:uint8, 8],
|
35
|
+
:groups_count, :uint8,
|
36
|
+
:arch, Architecture
|
37
|
+
)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|