crabstone 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGES.md +61 -0
- data/LICENSE +25 -0
- data/MANIFEST +312 -0
- data/README.md +103 -0
- data/Rakefile +27 -0
- data/bin/genconst +66 -0
- data/bin/genreg +99 -0
- data/crabstone.gemspec +27 -0
- data/examples/hello_world.rb +43 -0
- data/lib/arch/arm.rb +128 -0
- data/lib/arch/arm64.rb +167 -0
- data/lib/arch/arm64_const.rb +1055 -0
- data/lib/arch/arm64_registers.rb +295 -0
- data/lib/arch/arm_const.rb +777 -0
- data/lib/arch/arm_registers.rb +149 -0
- data/lib/arch/mips.rb +78 -0
- data/lib/arch/mips_const.rb +850 -0
- data/lib/arch/mips_registers.rb +208 -0
- data/lib/arch/ppc.rb +90 -0
- data/lib/arch/ppc_const.rb +1181 -0
- data/lib/arch/ppc_registers.rb +209 -0
- data/lib/arch/sparc.rb +79 -0
- data/lib/arch/sparc_const.rb +461 -0
- data/lib/arch/sparc_registers.rb +121 -0
- data/lib/arch/systemz.rb +79 -0
- data/lib/arch/sysz_const.rb +779 -0
- data/lib/arch/sysz_registers.rb +66 -0
- data/lib/arch/x86.rb +107 -0
- data/lib/arch/x86_const.rb +1698 -0
- data/lib/arch/x86_registers.rb +265 -0
- data/lib/arch/xcore.rb +78 -0
- data/lib/arch/xcore_const.rb +185 -0
- data/lib/arch/xcore_registers.rb +57 -0
- data/lib/crabstone.rb +564 -0
- data/test/MC/AArch64/basic-a64-instructions.s.cs +2014 -0
- data/test/MC/AArch64/gicv3-regs.s.cs +111 -0
- data/test/MC/AArch64/neon-2velem.s.cs +113 -0
- data/test/MC/AArch64/neon-3vdiff.s.cs +143 -0
- data/test/MC/AArch64/neon-aba-abd.s.cs +28 -0
- data/test/MC/AArch64/neon-across.s.cs +40 -0
- data/test/MC/AArch64/neon-add-pairwise.s.cs +11 -0
- data/test/MC/AArch64/neon-add-sub-instructions.s.cs +21 -0
- data/test/MC/AArch64/neon-bitwise-instructions.s.cs +17 -0
- data/test/MC/AArch64/neon-compare-instructions.s.cs +136 -0
- data/test/MC/AArch64/neon-crypto.s.cs +15 -0
- data/test/MC/AArch64/neon-extract.s.cs +3 -0
- data/test/MC/AArch64/neon-facge-facgt.s.cs +13 -0
- data/test/MC/AArch64/neon-frsqrt-frecp.s.cs +7 -0
- data/test/MC/AArch64/neon-halving-add-sub.s.cs +25 -0
- data/test/MC/AArch64/neon-max-min-pairwise.s.cs +37 -0
- data/test/MC/AArch64/neon-max-min.s.cs +37 -0
- data/test/MC/AArch64/neon-mla-mls-instructions.s.cs +19 -0
- data/test/MC/AArch64/neon-mov.s.cs +74 -0
- data/test/MC/AArch64/neon-mul-div-instructions.s.cs +24 -0
- data/test/MC/AArch64/neon-perm.s.cs +43 -0
- data/test/MC/AArch64/neon-rounding-halving-add.s.cs +13 -0
- data/test/MC/AArch64/neon-rounding-shift.s.cs +15 -0
- data/test/MC/AArch64/neon-saturating-add-sub.s.cs +29 -0
- data/test/MC/AArch64/neon-saturating-rounding-shift.s.cs +15 -0
- data/test/MC/AArch64/neon-saturating-shift.s.cs +15 -0
- data/test/MC/AArch64/neon-scalar-abs.s.cs +8 -0
- data/test/MC/AArch64/neon-scalar-add-sub.s.cs +3 -0
- data/test/MC/AArch64/neon-scalar-by-elem-mla.s.cs +13 -0
- data/test/MC/AArch64/neon-scalar-by-elem-mul.s.cs +13 -0
- data/test/MC/AArch64/neon-scalar-by-elem-saturating-mla.s.cs +15 -0
- data/test/MC/AArch64/neon-scalar-by-elem-saturating-mul.s.cs +18 -0
- data/test/MC/AArch64/neon-scalar-compare.s.cs +12 -0
- data/test/MC/AArch64/neon-scalar-cvt.s.cs +34 -0
- data/test/MC/AArch64/neon-scalar-dup.s.cs +23 -0
- data/test/MC/AArch64/neon-scalar-extract-narrow.s.cs +10 -0
- data/test/MC/AArch64/neon-scalar-fp-compare.s.cs +21 -0
- data/test/MC/AArch64/neon-scalar-mul.s.cs +13 -0
- data/test/MC/AArch64/neon-scalar-neg.s.cs +6 -0
- data/test/MC/AArch64/neon-scalar-recip.s.cs +11 -0
- data/test/MC/AArch64/neon-scalar-reduce-pairwise.s.cs +3 -0
- data/test/MC/AArch64/neon-scalar-rounding-shift.s.cs +3 -0
- data/test/MC/AArch64/neon-scalar-saturating-add-sub.s.cs +25 -0
- data/test/MC/AArch64/neon-scalar-saturating-rounding-shift.s.cs +9 -0
- data/test/MC/AArch64/neon-scalar-saturating-shift.s.cs +9 -0
- data/test/MC/AArch64/neon-scalar-shift-imm.s.cs +42 -0
- data/test/MC/AArch64/neon-scalar-shift.s.cs +3 -0
- data/test/MC/AArch64/neon-shift-left-long.s.cs +13 -0
- data/test/MC/AArch64/neon-shift.s.cs +22 -0
- data/test/MC/AArch64/neon-simd-copy.s.cs +42 -0
- data/test/MC/AArch64/neon-simd-ldst-multi-elem.s.cs +197 -0
- data/test/MC/AArch64/neon-simd-ldst-one-elem.s.cs +129 -0
- data/test/MC/AArch64/neon-simd-misc.s.cs +213 -0
- data/test/MC/AArch64/neon-simd-post-ldst-multi-elem.s.cs +107 -0
- data/test/MC/AArch64/neon-simd-shift.s.cs +151 -0
- data/test/MC/AArch64/neon-tbl.s.cs +21 -0
- data/test/MC/AArch64/trace-regs.s.cs +383 -0
- data/test/MC/ARM/arm-aliases.s.cs +7 -0
- data/test/MC/ARM/arm-arithmetic-aliases.s.cs +50 -0
- data/test/MC/ARM/arm-it-block.s.cs +2 -0
- data/test/MC/ARM/arm-memory-instructions.s.cs +138 -0
- data/test/MC/ARM/arm-shift-encoding.s.cs +50 -0
- data/test/MC/ARM/arm-thumb-trustzone.s.cs +3 -0
- data/test/MC/ARM/arm-trustzone.s.cs +3 -0
- data/test/MC/ARM/arm_addrmode2.s.cs +15 -0
- data/test/MC/ARM/arm_addrmode3.s.cs +9 -0
- data/test/MC/ARM/arm_instructions.s.cs +25 -0
- data/test/MC/ARM/basic-arm-instructions-v8.s.cs +10 -0
- data/test/MC/ARM/basic-arm-instructions.s.cs +997 -0
- data/test/MC/ARM/basic-thumb-instructions.s.cs +130 -0
- data/test/MC/ARM/basic-thumb2-instructions-v8.s.cs +1 -0
- data/test/MC/ARM/basic-thumb2-instructions.s.cs +1242 -0
- data/test/MC/ARM/crc32-thumb.s.cs +7 -0
- data/test/MC/ARM/crc32.s.cs +7 -0
- data/test/MC/ARM/dot-req.s.cs +3 -0
- data/test/MC/ARM/fp-armv8.s.cs +52 -0
- data/test/MC/ARM/idiv-thumb.s.cs +3 -0
- data/test/MC/ARM/idiv.s.cs +3 -0
- data/test/MC/ARM/load-store-acquire-release-v8-thumb.s.cs +15 -0
- data/test/MC/ARM/load-store-acquire-release-v8.s.cs +15 -0
- data/test/MC/ARM/mode-switch.s.cs +7 -0
- data/test/MC/ARM/neon-abs-encoding.s.cs +15 -0
- data/test/MC/ARM/neon-absdiff-encoding.s.cs +39 -0
- data/test/MC/ARM/neon-add-encoding.s.cs +119 -0
- data/test/MC/ARM/neon-bitcount-encoding.s.cs +15 -0
- data/test/MC/ARM/neon-bitwise-encoding.s.cs +126 -0
- data/test/MC/ARM/neon-cmp-encoding.s.cs +88 -0
- data/test/MC/ARM/neon-convert-encoding.s.cs +27 -0
- data/test/MC/ARM/neon-crypto.s.cs +16 -0
- data/test/MC/ARM/neon-dup-encoding.s.cs +13 -0
- data/test/MC/ARM/neon-minmax-encoding.s.cs +57 -0
- data/test/MC/ARM/neon-mov-encoding.s.cs +76 -0
- data/test/MC/ARM/neon-mul-accum-encoding.s.cs +39 -0
- data/test/MC/ARM/neon-mul-encoding.s.cs +72 -0
- data/test/MC/ARM/neon-neg-encoding.s.cs +15 -0
- data/test/MC/ARM/neon-pairwise-encoding.s.cs +47 -0
- data/test/MC/ARM/neon-reciprocal-encoding.s.cs +13 -0
- data/test/MC/ARM/neon-reverse-encoding.s.cs +13 -0
- data/test/MC/ARM/neon-satshift-encoding.s.cs +75 -0
- data/test/MC/ARM/neon-shift-encoding.s.cs +238 -0
- data/test/MC/ARM/neon-shiftaccum-encoding.s.cs +97 -0
- data/test/MC/ARM/neon-shuffle-encoding.s.cs +59 -0
- data/test/MC/ARM/neon-sub-encoding.s.cs +82 -0
- data/test/MC/ARM/neon-table-encoding.s.cs +9 -0
- data/test/MC/ARM/neon-v8.s.cs +38 -0
- data/test/MC/ARM/neon-vld-encoding.s.cs +213 -0
- data/test/MC/ARM/neon-vst-encoding.s.cs +120 -0
- data/test/MC/ARM/neon-vswp.s.cs +3 -0
- data/test/MC/ARM/neont2-abs-encoding.s.cs +15 -0
- data/test/MC/ARM/neont2-absdiff-encoding.s.cs +39 -0
- data/test/MC/ARM/neont2-add-encoding.s.cs +65 -0
- data/test/MC/ARM/neont2-bitcount-encoding.s.cs +15 -0
- data/test/MC/ARM/neont2-bitwise-encoding.s.cs +15 -0
- data/test/MC/ARM/neont2-cmp-encoding.s.cs +17 -0
- data/test/MC/ARM/neont2-convert-encoding.s.cs +19 -0
- data/test/MC/ARM/neont2-dup-encoding.s.cs +19 -0
- data/test/MC/ARM/neont2-minmax-encoding.s.cs +57 -0
- data/test/MC/ARM/neont2-mov-encoding.s.cs +58 -0
- data/test/MC/ARM/neont2-mul-accum-encoding.s.cs +41 -0
- data/test/MC/ARM/neont2-mul-encoding.s.cs +31 -0
- data/test/MC/ARM/neont2-neg-encoding.s.cs +15 -0
- data/test/MC/ARM/neont2-pairwise-encoding.s.cs +43 -0
- data/test/MC/ARM/neont2-reciprocal-encoding.s.cs +13 -0
- data/test/MC/ARM/neont2-reverse-encoding.s.cs +13 -0
- data/test/MC/ARM/neont2-satshift-encoding.s.cs +75 -0
- data/test/MC/ARM/neont2-shift-encoding.s.cs +80 -0
- data/test/MC/ARM/neont2-shiftaccum-encoding.s.cs +97 -0
- data/test/MC/ARM/neont2-shuffle-encoding.s.cs +23 -0
- data/test/MC/ARM/neont2-sub-encoding.s.cs +23 -0
- data/test/MC/ARM/neont2-table-encoding.s.cs +9 -0
- data/test/MC/ARM/neont2-vld-encoding.s.cs +51 -0
- data/test/MC/ARM/neont2-vst-encoding.s.cs +48 -0
- data/test/MC/ARM/simple-fp-encoding.s.cs +157 -0
- data/test/MC/ARM/thumb-fp-armv8.s.cs +51 -0
- data/test/MC/ARM/thumb-hints.s.cs +12 -0
- data/test/MC/ARM/thumb-neon-crypto.s.cs +16 -0
- data/test/MC/ARM/thumb-neon-v8.s.cs +38 -0
- data/test/MC/ARM/thumb-shift-encoding.s.cs +19 -0
- data/test/MC/ARM/thumb.s.cs +19 -0
- data/test/MC/ARM/thumb2-b.w-encodingT4.s.cs +2 -0
- data/test/MC/ARM/thumb2-branches.s.cs +85 -0
- data/test/MC/ARM/thumb2-mclass.s.cs +41 -0
- data/test/MC/ARM/thumb2-narrow-dp.ll.cs +379 -0
- data/test/MC/ARM/thumb2-pldw.s.cs +2 -0
- data/test/MC/ARM/vfp4-thumb.s.cs +13 -0
- data/test/MC/ARM/vfp4.s.cs +13 -0
- data/test/MC/ARM/vpush-vpop-thumb.s.cs +9 -0
- data/test/MC/ARM/vpush-vpop.s.cs +9 -0
- data/test/MC/Mips/hilo-addressing.s.cs +4 -0
- data/test/MC/Mips/micromips-alu-instructions-EB.s.cs +33 -0
- data/test/MC/Mips/micromips-alu-instructions.s.cs +33 -0
- data/test/MC/Mips/micromips-branch-instructions-EB.s.cs +11 -0
- data/test/MC/Mips/micromips-branch-instructions.s.cs +11 -0
- data/test/MC/Mips/micromips-expansions.s.cs +20 -0
- data/test/MC/Mips/micromips-jump-instructions-EB.s.cs +5 -0
- data/test/MC/Mips/micromips-jump-instructions.s.cs +6 -0
- data/test/MC/Mips/micromips-loadstore-instructions-EB.s.cs +9 -0
- data/test/MC/Mips/micromips-loadstore-instructions.s.cs +9 -0
- data/test/MC/Mips/micromips-loadstore-unaligned-EB.s.cs +5 -0
- data/test/MC/Mips/micromips-loadstore-unaligned.s.cs +5 -0
- data/test/MC/Mips/micromips-movcond-instructions-EB.s.cs +5 -0
- data/test/MC/Mips/micromips-movcond-instructions.s.cs +5 -0
- data/test/MC/Mips/micromips-multiply-instructions-EB.s.cs +5 -0
- data/test/MC/Mips/micromips-multiply-instructions.s.cs +5 -0
- data/test/MC/Mips/micromips-shift-instructions-EB.s.cs +9 -0
- data/test/MC/Mips/micromips-shift-instructions.s.cs +9 -0
- data/test/MC/Mips/micromips-trap-instructions-EB.s.cs +13 -0
- data/test/MC/Mips/micromips-trap-instructions.s.cs +13 -0
- data/test/MC/Mips/mips-alu-instructions.s.cs +53 -0
- data/test/MC/Mips/mips-control-instructions-64.s.cs +33 -0
- data/test/MC/Mips/mips-control-instructions.s.cs +33 -0
- data/test/MC/Mips/mips-coprocessor-encodings.s.cs +17 -0
- data/test/MC/Mips/mips-dsp-instructions.s.cs +43 -0
- data/test/MC/Mips/mips-expansions.s.cs +20 -0
- data/test/MC/Mips/mips-fpu-instructions.s.cs +93 -0
- data/test/MC/Mips/mips-jump-instructions.s.cs +1 -0
- data/test/MC/Mips/mips-memory-instructions.s.cs +17 -0
- data/test/MC/Mips/mips-register-names.s.cs +33 -0
- data/test/MC/Mips/mips64-alu-instructions.s.cs +47 -0
- data/test/MC/Mips/mips64-instructions.s.cs +3 -0
- data/test/MC/Mips/mips64-register-names.s.cs +33 -0
- data/test/MC/Mips/mips_directives.s.cs +12 -0
- data/test/MC/Mips/nabi-regs.s.cs +12 -0
- data/test/MC/Mips/set-at-directive.s.cs +6 -0
- data/test/MC/Mips/test_2r.s.cs +16 -0
- data/test/MC/Mips/test_2rf.s.cs +33 -0
- data/test/MC/Mips/test_3r.s.cs +243 -0
- data/test/MC/Mips/test_3rf.s.cs +83 -0
- data/test/MC/Mips/test_bit.s.cs +49 -0
- data/test/MC/Mips/test_cbranch.s.cs +11 -0
- data/test/MC/Mips/test_ctrlregs.s.cs +33 -0
- data/test/MC/Mips/test_elm.s.cs +16 -0
- data/test/MC/Mips/test_elm_insert.s.cs +4 -0
- data/test/MC/Mips/test_elm_insve.s.cs +5 -0
- data/test/MC/Mips/test_i10.s.cs +5 -0
- data/test/MC/Mips/test_i5.s.cs +45 -0
- data/test/MC/Mips/test_i8.s.cs +11 -0
- data/test/MC/Mips/test_lsa.s.cs +5 -0
- data/test/MC/Mips/test_mi10.s.cs +24 -0
- data/test/MC/Mips/test_vec.s.cs +8 -0
- data/test/MC/PowerPC/ppc64-encoding-bookII.s.cs +25 -0
- data/test/MC/PowerPC/ppc64-encoding-bookIII.s.cs +35 -0
- data/test/MC/PowerPC/ppc64-encoding-ext.s.cs +535 -0
- data/test/MC/PowerPC/ppc64-encoding-fp.s.cs +110 -0
- data/test/MC/PowerPC/ppc64-encoding-vmx.s.cs +170 -0
- data/test/MC/PowerPC/ppc64-encoding.s.cs +202 -0
- data/test/MC/PowerPC/ppc64-operands.s.cs +32 -0
- data/test/MC/README +6 -0
- data/test/MC/Sparc/sparc-alu-instructions.s.cs +47 -0
- data/test/MC/Sparc/sparc-atomic-instructions.s.cs +7 -0
- data/test/MC/Sparc/sparc-ctrl-instructions.s.cs +11 -0
- data/test/MC/Sparc/sparc-fp-instructions.s.cs +59 -0
- data/test/MC/Sparc/sparc-mem-instructions.s.cs +25 -0
- data/test/MC/Sparc/sparc-vis.s.cs +2 -0
- data/test/MC/Sparc/sparc64-alu-instructions.s.cs +13 -0
- data/test/MC/Sparc/sparc64-ctrl-instructions.s.cs +102 -0
- data/test/MC/Sparc/sparcv8-instructions.s.cs +7 -0
- data/test/MC/Sparc/sparcv9-instructions.s.cs +1 -0
- data/test/MC/SystemZ/insn-good-z196.s.cs +589 -0
- data/test/MC/SystemZ/insn-good.s.cs +2265 -0
- data/test/MC/SystemZ/regs-good.s.cs +45 -0
- data/test/MC/X86/3DNow.s.cs +29 -0
- data/test/MC/X86/address-size.s.cs +5 -0
- data/test/MC/X86/avx512-encodings.s.cs +12 -0
- data/test/MC/X86/intel-syntax-encoding.s.cs +30 -0
- data/test/MC/X86/x86-32-avx.s.cs +833 -0
- data/test/MC/X86/x86-32-fma3.s.cs +169 -0
- data/test/MC/X86/x86-32-ms-inline-asm.s.cs +27 -0
- data/test/MC/X86/x86_64-avx-clmul-encoding.s.cs +11 -0
- data/test/MC/X86/x86_64-avx-encoding.s.cs +1058 -0
- data/test/MC/X86/x86_64-bmi-encoding.s.cs +51 -0
- data/test/MC/X86/x86_64-encoding.s.cs +59 -0
- data/test/MC/X86/x86_64-fma3-encoding.s.cs +169 -0
- data/test/MC/X86/x86_64-fma4-encoding.s.cs +98 -0
- data/test/MC/X86/x86_64-hle-encoding.s.cs +3 -0
- data/test/MC/X86/x86_64-imm-widths.s.cs +27 -0
- data/test/MC/X86/x86_64-rand-encoding.s.cs +13 -0
- data/test/MC/X86/x86_64-rtm-encoding.s.cs +4 -0
- data/test/MC/X86/x86_64-sse4a.s.cs +1 -0
- data/test/MC/X86/x86_64-tbm-encoding.s.cs +40 -0
- data/test/MC/X86/x86_64-xop-encoding.s.cs +152 -0
- data/test/README +6 -0
- data/test/test.rb +205 -0
- data/test/test.rb.SPEC +235 -0
- data/test/test_arm.rb +202 -0
- data/test/test_arm.rb.SPEC +275 -0
- data/test/test_arm64.rb +150 -0
- data/test/test_arm64.rb.SPEC +116 -0
- data/test/test_detail.rb +228 -0
- data/test/test_detail.rb.SPEC +322 -0
- data/test/test_exhaustive.rb +80 -0
- data/test/test_mips.rb +118 -0
- data/test/test_mips.rb.SPEC +91 -0
- data/test/test_ppc.rb +137 -0
- data/test/test_ppc.rb.SPEC +84 -0
- data/test/test_sanity.rb +83 -0
- data/test/test_skipdata.rb +111 -0
- data/test/test_skipdata.rb.SPEC +58 -0
- data/test/test_sparc.rb +113 -0
- data/test/test_sparc.rb.SPEC +116 -0
- data/test/test_sysz.rb +111 -0
- data/test/test_sysz.rb.SPEC +61 -0
- data/test/test_x86.rb +189 -0
- data/test/test_x86.rb.SPEC +579 -0
- data/test/test_xcore.rb +100 -0
- data/test/test_xcore.rb.SPEC +75 -0
- metadata +393 -0
data/test/test_x86.rb
ADDED
@@ -0,0 +1,189 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Library by Nguyen Anh Quynh
|
4
|
+
# Original binding by Nguyen Anh Quynh and Tan Sheng Di
|
5
|
+
# Additional binding work by Ben Nagy
|
6
|
+
# (c) 2013 COSEINC. All Rights Reserved.
|
7
|
+
|
8
|
+
# This is UGLY, but it's ported C test code, sorry. :(
|
9
|
+
|
10
|
+
require 'crabstone'
|
11
|
+
require 'stringio'
|
12
|
+
|
13
|
+
module TestX86
|
14
|
+
|
15
|
+
X86_CODE64 = "\x55\x48\x8b\x05\xb8\x13\x00\x00"
|
16
|
+
X86_CODE16 = "\x8d\x4c\x32\x08\x01\xd8\x81\xc6\x34\x12\x00\x00\x05\x23\x01\x00\x00\x36\x8b\x84\x91\x23\x01\x00\x00\x41\x8d\x84\x39\x89\x67\x00\x00\x8d\x87\x89\x67\x00\x00\xb4\xc6"
|
17
|
+
X86_CODE32 = "\x8d\x4c\x32\x08\x01\xd8\x81\xc6\x34\x12\x00\x00\x05\x23\x01\x00\x00\x36\x8b\x84\x91\x23\x01\x00\x00\x41\x8d\x84\x39\x89\x67\x00\x00\x8d\x87\x89\x67\x00\x00\xb4\xc6"
|
18
|
+
|
19
|
+
include Crabstone
|
20
|
+
include Crabstone::X86
|
21
|
+
|
22
|
+
@platforms = [
|
23
|
+
Hash[
|
24
|
+
'arch' => ARCH_X86,
|
25
|
+
'mode' => MODE_16,
|
26
|
+
'code' => X86_CODE16,
|
27
|
+
'comment' => "X86 16bit (Intel syntax)"
|
28
|
+
],
|
29
|
+
Hash[
|
30
|
+
'arch' => ARCH_X86,
|
31
|
+
'mode' => MODE_32,
|
32
|
+
'code' => X86_CODE32,
|
33
|
+
'syntax' => :att,
|
34
|
+
'comment' => "X86 32 (AT&T syntax)"
|
35
|
+
],
|
36
|
+
Hash[
|
37
|
+
'arch' => ARCH_X86,
|
38
|
+
'mode' => MODE_32,
|
39
|
+
'code' => X86_CODE32,
|
40
|
+
'comment' => "X86 32 (Intel syntax)"
|
41
|
+
],
|
42
|
+
Hash[
|
43
|
+
'arch' => ARCH_X86,
|
44
|
+
'mode' => MODE_64,
|
45
|
+
'code' => X86_CODE64,
|
46
|
+
'comment' => "X86 64 (Intel syntax)"
|
47
|
+
]
|
48
|
+
]
|
49
|
+
|
50
|
+
def self.uint32 i
|
51
|
+
Integer(i) & 0xffffffff
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.uint64 i
|
55
|
+
Integer(i) & 0xffffffffffffffff
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.print_detail cs, i, mode, sio
|
59
|
+
|
60
|
+
sio.puts("\tPrefix:#{i.prefix.to_a.map {|b| "0x%.2x" % b}.join(' ')} ")
|
61
|
+
sio.puts("\tOpcode:#{i.opcode.to_a.map {|b| "0x%.2x" % b}.join(' ')} ")
|
62
|
+
sio.printf("\trex: 0x%x\n", uint32(i[:rex]))
|
63
|
+
sio.printf("\taddr_size: %u\n", uint32(i[:addr_size]))
|
64
|
+
sio.printf("\tmodrm: 0x%x\n", i.modrm)
|
65
|
+
sio.printf("\tdisp: 0x%x\n", (self.uint32(i.disp)))
|
66
|
+
|
67
|
+
# // SIB is not available in 16-bit mode
|
68
|
+
unless mode == MODE_16
|
69
|
+
sio.printf("\tsib: 0x%x\n", i.sib)
|
70
|
+
unless i.sib_index == REG_INVALID
|
71
|
+
sio.printf(
|
72
|
+
"\t\tsib_base: %s\n\t\tsib_index: %s\n\t\tsib_scale: %u\n",
|
73
|
+
cs.reg_name(i.sib_base),
|
74
|
+
cs.reg_name(i.sib_index),
|
75
|
+
i.sib_scale
|
76
|
+
)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
sio.printf("\tsse_cc: %d\n", i[:sse_cc]) if i[:sse_cc].nonzero?
|
81
|
+
sio.printf("\tavx_cc: %d\n", i[:avx_cc]) if i[:avx_cc].nonzero?
|
82
|
+
sio.printf("\tavx_sae: True\n") if i[:avx_sae]
|
83
|
+
sio.printf("\tavx_rm: %d\n", i[:avx_rm]) if i[:avx_rm].nonzero?
|
84
|
+
|
85
|
+
if i.reads_reg?( :eax ) || i.reads_reg?( 19 ) || i.reads_reg?( REG_EAX )
|
86
|
+
print '[eax:r] '
|
87
|
+
unless i.reads_reg?( :eax ) && i.reads_reg?( 'eax' ) && i.reads_reg?( 19 ) && i.reads_reg?( REG_EAX )
|
88
|
+
fail "Error in reg read decomposition"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
if i.writes_reg?( 'eax' ) || i.writes_reg?( 19 ) || i.writes_reg?( REG_EAX )
|
93
|
+
print '[eax:w] '
|
94
|
+
unless i.writes_reg?( 'eax' ) && i.writes_reg?( 19 ) && i.writes_reg?( REG_EAX )
|
95
|
+
fail "Error in reg write decomposition"
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
if (count=i.op_count(OP_IMM)).nonzero?
|
100
|
+
sio.puts "\timm_count: #{count}"
|
101
|
+
i.operands.select(&:imm?).each_with_index {|op,j|
|
102
|
+
sio.puts "\t\timms[#{j+1}]: 0x#{self.uint64(op.value).to_s(16)}"
|
103
|
+
}
|
104
|
+
end
|
105
|
+
|
106
|
+
if i.op_count > 0 then
|
107
|
+
sio.puts "\top_count: #{i.op_count}"
|
108
|
+
i.operands.each_with_index do |op,c|
|
109
|
+
if op.reg?
|
110
|
+
sio.puts "\t\toperands[#{c}].type: REG = #{cs.reg_name(op.value)}"
|
111
|
+
elsif op.imm?
|
112
|
+
sio.puts "\t\toperands[#{c}].type: IMM = 0x#{self.uint64(op.value).to_s(16)}"
|
113
|
+
elsif op.fp?
|
114
|
+
sio.puts "\t\toperands[#{c}].type: FP = 0x#{(self.uint32(op.value))}"
|
115
|
+
elsif op.mem?
|
116
|
+
sio.puts "\t\toperands[#{c}].type: MEM"
|
117
|
+
if op.value[:segment].nonzero?
|
118
|
+
sio.puts "\t\t\toperands[#{c}].mem.segment: REG = %s" % cs.reg_name(op.value[:segment])
|
119
|
+
end
|
120
|
+
if op.value[:base].nonzero?
|
121
|
+
sio.puts "\t\t\toperands[#{c}].mem.base: REG = %s" % cs.reg_name(op.value[:base])
|
122
|
+
end
|
123
|
+
if op.value[:index].nonzero?
|
124
|
+
sio.puts "\t\t\toperands[#{c}].mem.index: REG = %s" % cs.reg_name(op.value[:index])
|
125
|
+
end
|
126
|
+
if op.value[:scale] != 1
|
127
|
+
sio.puts "\t\t\toperands[#{c}].mem.scale: %u" % op.value[:scale]
|
128
|
+
end
|
129
|
+
if op.value[:disp].nonzero?
|
130
|
+
sio.puts "\t\t\toperands[#{c}].mem.disp: 0x%x" % (self.uint64(op.value[:disp]))
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
sio.printf("\t\toperands[#{c}].avx_bcast: %u\n", op[:avx_bcast]) if op[:avx_bcast].nonzero?
|
135
|
+
sio.printf("\t\toperands[#{c}].avx_zero_opmask: TRUE\n") if op[:avx_zero_opmask]
|
136
|
+
sio.printf("\t\toperands[#{c}].size: %u\n", op[:size])
|
137
|
+
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
sio.puts
|
142
|
+
end
|
143
|
+
|
144
|
+
ours = StringIO.new
|
145
|
+
|
146
|
+
#Test through all modes and architectures
|
147
|
+
begin
|
148
|
+
cs = Disassembler.new(0,0)
|
149
|
+
print "X86 Test: Capstone v #{cs.version.join('.')} - "
|
150
|
+
ensure
|
151
|
+
cs.close
|
152
|
+
end
|
153
|
+
@platforms.each do |p|
|
154
|
+
ours.puts "****************"
|
155
|
+
ours.puts "Platform: #{p['comment']}"
|
156
|
+
ours.puts "Code:#{p['code'].bytes.map {|b| "0x%.2x" % b}.join(' ')} "
|
157
|
+
ours.puts "Disasm:"
|
158
|
+
|
159
|
+
cs = Disassembler.new(p['arch'], p['mode'])
|
160
|
+
cs.decomposer = true
|
161
|
+
if p['syntax']
|
162
|
+
cs.syntax = p['syntax']
|
163
|
+
end
|
164
|
+
cache = nil
|
165
|
+
|
166
|
+
# This form is NOT RECOMMENDED in real code except as a last resort - use
|
167
|
+
# the block form if possible.
|
168
|
+
insns = cs.disasm(p['code'], 0x1000)
|
169
|
+
|
170
|
+
insns.each {|insn|
|
171
|
+
ours.puts "0x#{insn.address.to_s(16)}:\t#{insn.mnemonic}\t#{insn.op_str}"
|
172
|
+
self.print_detail(cs, insn, cs.mode, ours)
|
173
|
+
cache = insn
|
174
|
+
}
|
175
|
+
ours.printf("0x%x:\n", cache.address + cache.size)
|
176
|
+
ours.puts
|
177
|
+
cs.close
|
178
|
+
end
|
179
|
+
|
180
|
+
ours.rewind
|
181
|
+
theirs = File.binread(__FILE__ + ".SPEC")
|
182
|
+
if ours.read == theirs
|
183
|
+
puts "#{__FILE__}: PASS"
|
184
|
+
else
|
185
|
+
ours.rewind
|
186
|
+
puts ours.read
|
187
|
+
puts "#{__FILE__}: FAIL"
|
188
|
+
end
|
189
|
+
end
|
@@ -0,0 +1,579 @@
|
|
1
|
+
****************
|
2
|
+
Platform: X86 16bit (Intel syntax)
|
3
|
+
Code:0x8d 0x4c 0x32 0x08 0x01 0xd8 0x81 0xc6 0x34 0x12 0x00 0x00 0x05 0x23 0x01 0x00 0x00 0x36 0x8b 0x84 0x91 0x23 0x01 0x00 0x00 0x41 0x8d 0x84 0x39 0x89 0x67 0x00 0x00 0x8d 0x87 0x89 0x67 0x00 0x00 0xb4 0xc6
|
4
|
+
Disasm:
|
5
|
+
0x1000: lea cx, word ptr [si + 0x32]
|
6
|
+
Prefix:0x00 0x00 0x00 0x00
|
7
|
+
Opcode:0x8d 0x00 0x00 0x00
|
8
|
+
rex: 0x0
|
9
|
+
addr_size: 2
|
10
|
+
modrm: 0x4c
|
11
|
+
disp: 0x32
|
12
|
+
op_count: 2
|
13
|
+
operands[0].type: REG = cx
|
14
|
+
operands[0].size: 2
|
15
|
+
operands[1].type: MEM
|
16
|
+
operands[1].mem.base: REG = si
|
17
|
+
operands[1].mem.disp: 0x32
|
18
|
+
operands[1].size: 2
|
19
|
+
|
20
|
+
0x1003: or byte ptr [bx + di], al
|
21
|
+
Prefix:0x00 0x00 0x00 0x00
|
22
|
+
Opcode:0x08 0x00 0x00 0x00
|
23
|
+
rex: 0x0
|
24
|
+
addr_size: 2
|
25
|
+
modrm: 0x1
|
26
|
+
disp: 0x0
|
27
|
+
op_count: 2
|
28
|
+
operands[0].type: MEM
|
29
|
+
operands[0].mem.base: REG = bx
|
30
|
+
operands[0].mem.index: REG = di
|
31
|
+
operands[0].size: 1
|
32
|
+
operands[1].type: REG = al
|
33
|
+
operands[1].size: 1
|
34
|
+
|
35
|
+
0x1005: fadd dword ptr [bx + di + 0x34c6]
|
36
|
+
Prefix:0x00 0x00 0x00 0x00
|
37
|
+
Opcode:0xd8 0x00 0x00 0x00
|
38
|
+
rex: 0x0
|
39
|
+
addr_size: 2
|
40
|
+
modrm: 0x81
|
41
|
+
disp: 0x34c6
|
42
|
+
op_count: 1
|
43
|
+
operands[0].type: MEM
|
44
|
+
operands[0].mem.base: REG = bx
|
45
|
+
operands[0].mem.index: REG = di
|
46
|
+
operands[0].mem.disp: 0x34c6
|
47
|
+
operands[0].size: 4
|
48
|
+
|
49
|
+
0x1009: adc al, byte ptr [bx + si]
|
50
|
+
Prefix:0x00 0x00 0x00 0x00
|
51
|
+
Opcode:0x12 0x00 0x00 0x00
|
52
|
+
rex: 0x0
|
53
|
+
addr_size: 2
|
54
|
+
modrm: 0x0
|
55
|
+
disp: 0x0
|
56
|
+
op_count: 2
|
57
|
+
operands[0].type: REG = al
|
58
|
+
operands[0].size: 1
|
59
|
+
operands[1].type: MEM
|
60
|
+
operands[1].mem.base: REG = bx
|
61
|
+
operands[1].mem.index: REG = si
|
62
|
+
operands[1].size: 1
|
63
|
+
|
64
|
+
0x100b: add byte ptr [di], al
|
65
|
+
Prefix:0x00 0x00 0x00 0x00
|
66
|
+
Opcode:0x00 0x00 0x00 0x00
|
67
|
+
rex: 0x0
|
68
|
+
addr_size: 2
|
69
|
+
modrm: 0x5
|
70
|
+
disp: 0x0
|
71
|
+
op_count: 2
|
72
|
+
operands[0].type: MEM
|
73
|
+
operands[0].mem.base: REG = di
|
74
|
+
operands[0].size: 1
|
75
|
+
operands[1].type: REG = al
|
76
|
+
operands[1].size: 1
|
77
|
+
|
78
|
+
0x100d: and ax, word ptr [bx + di]
|
79
|
+
Prefix:0x00 0x00 0x00 0x00
|
80
|
+
Opcode:0x23 0x00 0x00 0x00
|
81
|
+
rex: 0x0
|
82
|
+
addr_size: 2
|
83
|
+
modrm: 0x1
|
84
|
+
disp: 0x0
|
85
|
+
op_count: 2
|
86
|
+
operands[0].type: REG = ax
|
87
|
+
operands[0].size: 2
|
88
|
+
operands[1].type: MEM
|
89
|
+
operands[1].mem.base: REG = bx
|
90
|
+
operands[1].mem.index: REG = di
|
91
|
+
operands[1].size: 2
|
92
|
+
|
93
|
+
0x100f: add byte ptr [bx + si], al
|
94
|
+
Prefix:0x00 0x00 0x00 0x00
|
95
|
+
Opcode:0x00 0x00 0x00 0x00
|
96
|
+
rex: 0x0
|
97
|
+
addr_size: 2
|
98
|
+
modrm: 0x0
|
99
|
+
disp: 0x0
|
100
|
+
op_count: 2
|
101
|
+
operands[0].type: MEM
|
102
|
+
operands[0].mem.base: REG = bx
|
103
|
+
operands[0].mem.index: REG = si
|
104
|
+
operands[0].size: 1
|
105
|
+
operands[1].type: REG = al
|
106
|
+
operands[1].size: 1
|
107
|
+
|
108
|
+
0x1011: mov ax, word ptr ss:[si + 0x2391]
|
109
|
+
Prefix:0x00 0x36 0x00 0x00
|
110
|
+
Opcode:0x8b 0x00 0x00 0x00
|
111
|
+
rex: 0x0
|
112
|
+
addr_size: 2
|
113
|
+
modrm: 0x84
|
114
|
+
disp: 0x2391
|
115
|
+
op_count: 2
|
116
|
+
operands[0].type: REG = ax
|
117
|
+
operands[0].size: 2
|
118
|
+
operands[1].type: MEM
|
119
|
+
operands[1].mem.segment: REG = ss
|
120
|
+
operands[1].mem.base: REG = si
|
121
|
+
operands[1].mem.disp: 0x2391
|
122
|
+
operands[1].size: 2
|
123
|
+
|
124
|
+
0x1016: add word ptr [bx + si], ax
|
125
|
+
Prefix:0x00 0x00 0x00 0x00
|
126
|
+
Opcode:0x01 0x00 0x00 0x00
|
127
|
+
rex: 0x0
|
128
|
+
addr_size: 2
|
129
|
+
modrm: 0x0
|
130
|
+
disp: 0x0
|
131
|
+
op_count: 2
|
132
|
+
operands[0].type: MEM
|
133
|
+
operands[0].mem.base: REG = bx
|
134
|
+
operands[0].mem.index: REG = si
|
135
|
+
operands[0].size: 2
|
136
|
+
operands[1].type: REG = ax
|
137
|
+
operands[1].size: 2
|
138
|
+
|
139
|
+
0x1018: add byte ptr [bx + di - 0x73], al
|
140
|
+
Prefix:0x00 0x00 0x00 0x00
|
141
|
+
Opcode:0x00 0x00 0x00 0x00
|
142
|
+
rex: 0x0
|
143
|
+
addr_size: 2
|
144
|
+
modrm: 0x41
|
145
|
+
disp: 0xffffff8d
|
146
|
+
op_count: 2
|
147
|
+
operands[0].type: MEM
|
148
|
+
operands[0].mem.base: REG = bx
|
149
|
+
operands[0].mem.index: REG = di
|
150
|
+
operands[0].mem.disp: 0xffffffffffffff8d
|
151
|
+
operands[0].size: 1
|
152
|
+
operands[1].type: REG = al
|
153
|
+
operands[1].size: 1
|
154
|
+
|
155
|
+
0x101b: test byte ptr [bx + di], bh
|
156
|
+
Prefix:0x00 0x00 0x00 0x00
|
157
|
+
Opcode:0x84 0x00 0x00 0x00
|
158
|
+
rex: 0x0
|
159
|
+
addr_size: 2
|
160
|
+
modrm: 0x39
|
161
|
+
disp: 0x0
|
162
|
+
op_count: 2
|
163
|
+
operands[0].type: MEM
|
164
|
+
operands[0].mem.base: REG = bx
|
165
|
+
operands[0].mem.index: REG = di
|
166
|
+
operands[0].size: 1
|
167
|
+
operands[1].type: REG = bh
|
168
|
+
operands[1].size: 1
|
169
|
+
|
170
|
+
0x101d: mov word ptr [bx], sp
|
171
|
+
Prefix:0x00 0x00 0x00 0x00
|
172
|
+
Opcode:0x89 0x00 0x00 0x00
|
173
|
+
rex: 0x0
|
174
|
+
addr_size: 2
|
175
|
+
modrm: 0x67
|
176
|
+
disp: 0x0
|
177
|
+
op_count: 2
|
178
|
+
operands[0].type: MEM
|
179
|
+
operands[0].mem.base: REG = bx
|
180
|
+
operands[0].size: 2
|
181
|
+
operands[1].type: REG = sp
|
182
|
+
operands[1].size: 2
|
183
|
+
|
184
|
+
0x1020: add byte ptr [di - 0x7679], cl
|
185
|
+
Prefix:0x00 0x00 0x00 0x00
|
186
|
+
Opcode:0x00 0x00 0x00 0x00
|
187
|
+
rex: 0x0
|
188
|
+
addr_size: 2
|
189
|
+
modrm: 0x8d
|
190
|
+
disp: 0xffff8987
|
191
|
+
op_count: 2
|
192
|
+
operands[0].type: MEM
|
193
|
+
operands[0].mem.base: REG = di
|
194
|
+
operands[0].mem.disp: 0xffffffffffff8987
|
195
|
+
operands[0].size: 1
|
196
|
+
operands[1].type: REG = cl
|
197
|
+
operands[1].size: 1
|
198
|
+
|
199
|
+
0x1024: add byte ptr [eax], al
|
200
|
+
Prefix:0x00 0x00 0x00 0x67
|
201
|
+
Opcode:0x00 0x00 0x00 0x00
|
202
|
+
rex: 0x0
|
203
|
+
addr_size: 4
|
204
|
+
modrm: 0x0
|
205
|
+
disp: 0x0
|
206
|
+
op_count: 2
|
207
|
+
operands[0].type: MEM
|
208
|
+
operands[0].mem.base: REG = eax
|
209
|
+
operands[0].size: 1
|
210
|
+
operands[1].type: REG = al
|
211
|
+
operands[1].size: 1
|
212
|
+
|
213
|
+
0x1027: mov ah, -0x3a
|
214
|
+
Prefix:0x00 0x00 0x00 0x00
|
215
|
+
Opcode:0xb4 0x00 0x00 0x00
|
216
|
+
rex: 0x0
|
217
|
+
addr_size: 2
|
218
|
+
modrm: 0x0
|
219
|
+
disp: 0x0
|
220
|
+
imm_count: 1
|
221
|
+
imms[1]: 0xffffffffffffffc6
|
222
|
+
op_count: 2
|
223
|
+
operands[0].type: REG = ah
|
224
|
+
operands[0].size: 1
|
225
|
+
operands[1].type: IMM = 0xffffffffffffffc6
|
226
|
+
operands[1].size: 1
|
227
|
+
|
228
|
+
0x1029:
|
229
|
+
|
230
|
+
****************
|
231
|
+
Platform: X86 32 (AT&T syntax)
|
232
|
+
Code:0x8d 0x4c 0x32 0x08 0x01 0xd8 0x81 0xc6 0x34 0x12 0x00 0x00 0x05 0x23 0x01 0x00 0x00 0x36 0x8b 0x84 0x91 0x23 0x01 0x00 0x00 0x41 0x8d 0x84 0x39 0x89 0x67 0x00 0x00 0x8d 0x87 0x89 0x67 0x00 0x00 0xb4 0xc6
|
233
|
+
Disasm:
|
234
|
+
0x1000: leal 8(%edx, %esi), %ecx
|
235
|
+
Prefix:0x00 0x00 0x00 0x00
|
236
|
+
Opcode:0x8d 0x00 0x00 0x00
|
237
|
+
rex: 0x0
|
238
|
+
addr_size: 4
|
239
|
+
modrm: 0x4c
|
240
|
+
disp: 0x8
|
241
|
+
sib: 0x32
|
242
|
+
sib_base: edx
|
243
|
+
sib_index: esi
|
244
|
+
sib_scale: 1
|
245
|
+
op_count: 2
|
246
|
+
operands[0].type: MEM
|
247
|
+
operands[0].mem.base: REG = edx
|
248
|
+
operands[0].mem.index: REG = esi
|
249
|
+
operands[0].mem.disp: 0x8
|
250
|
+
operands[0].size: 4
|
251
|
+
operands[1].type: REG = ecx
|
252
|
+
operands[1].size: 4
|
253
|
+
|
254
|
+
0x1004: addl %ebx, %eax
|
255
|
+
Prefix:0x00 0x00 0x00 0x00
|
256
|
+
Opcode:0x01 0x00 0x00 0x00
|
257
|
+
rex: 0x0
|
258
|
+
addr_size: 4
|
259
|
+
modrm: 0xd8
|
260
|
+
disp: 0x0
|
261
|
+
sib: 0x0
|
262
|
+
op_count: 2
|
263
|
+
operands[0].type: REG = ebx
|
264
|
+
operands[0].size: 4
|
265
|
+
operands[1].type: REG = eax
|
266
|
+
operands[1].size: 4
|
267
|
+
|
268
|
+
0x1006: addl $0x1234, %esi
|
269
|
+
Prefix:0x00 0x00 0x00 0x00
|
270
|
+
Opcode:0x81 0x00 0x00 0x00
|
271
|
+
rex: 0x0
|
272
|
+
addr_size: 4
|
273
|
+
modrm: 0xc6
|
274
|
+
disp: 0x0
|
275
|
+
sib: 0x0
|
276
|
+
imm_count: 1
|
277
|
+
imms[1]: 0x1234
|
278
|
+
op_count: 2
|
279
|
+
operands[0].type: IMM = 0x1234
|
280
|
+
operands[0].size: 4
|
281
|
+
operands[1].type: REG = esi
|
282
|
+
operands[1].size: 4
|
283
|
+
|
284
|
+
0x100c: addl $0x123, %eax
|
285
|
+
Prefix:0x00 0x00 0x00 0x00
|
286
|
+
Opcode:0x05 0x00 0x00 0x00
|
287
|
+
rex: 0x0
|
288
|
+
addr_size: 4
|
289
|
+
modrm: 0x0
|
290
|
+
disp: 0x0
|
291
|
+
sib: 0x0
|
292
|
+
imm_count: 1
|
293
|
+
imms[1]: 0x123
|
294
|
+
op_count: 2
|
295
|
+
operands[0].type: IMM = 0x123
|
296
|
+
operands[0].size: 4
|
297
|
+
operands[1].type: REG = eax
|
298
|
+
operands[1].size: 4
|
299
|
+
|
300
|
+
0x1011: movl %ss:0x123(%ecx, %edx, 4), %eax
|
301
|
+
Prefix:0x00 0x36 0x00 0x00
|
302
|
+
Opcode:0x8b 0x00 0x00 0x00
|
303
|
+
rex: 0x0
|
304
|
+
addr_size: 4
|
305
|
+
modrm: 0x84
|
306
|
+
disp: 0x123
|
307
|
+
sib: 0x91
|
308
|
+
sib_base: ecx
|
309
|
+
sib_index: edx
|
310
|
+
sib_scale: 4
|
311
|
+
op_count: 2
|
312
|
+
operands[0].type: MEM
|
313
|
+
operands[0].mem.segment: REG = ss
|
314
|
+
operands[0].mem.base: REG = ecx
|
315
|
+
operands[0].mem.index: REG = edx
|
316
|
+
operands[0].mem.scale: 4
|
317
|
+
operands[0].mem.disp: 0x123
|
318
|
+
operands[0].size: 4
|
319
|
+
operands[1].type: REG = eax
|
320
|
+
operands[1].size: 4
|
321
|
+
|
322
|
+
0x1019: incl %ecx
|
323
|
+
Prefix:0x00 0x00 0x00 0x00
|
324
|
+
Opcode:0x41 0x00 0x00 0x00
|
325
|
+
rex: 0x0
|
326
|
+
addr_size: 4
|
327
|
+
modrm: 0x0
|
328
|
+
disp: 0x0
|
329
|
+
sib: 0x0
|
330
|
+
op_count: 1
|
331
|
+
operands[0].type: REG = ecx
|
332
|
+
operands[0].size: 4
|
333
|
+
|
334
|
+
0x101a: leal 0x6789(%ecx, %edi), %eax
|
335
|
+
Prefix:0x00 0x00 0x00 0x00
|
336
|
+
Opcode:0x8d 0x00 0x00 0x00
|
337
|
+
rex: 0x0
|
338
|
+
addr_size: 4
|
339
|
+
modrm: 0x84
|
340
|
+
disp: 0x6789
|
341
|
+
sib: 0x39
|
342
|
+
sib_base: ecx
|
343
|
+
sib_index: edi
|
344
|
+
sib_scale: 1
|
345
|
+
op_count: 2
|
346
|
+
operands[0].type: MEM
|
347
|
+
operands[0].mem.base: REG = ecx
|
348
|
+
operands[0].mem.index: REG = edi
|
349
|
+
operands[0].mem.disp: 0x6789
|
350
|
+
operands[0].size: 4
|
351
|
+
operands[1].type: REG = eax
|
352
|
+
operands[1].size: 4
|
353
|
+
|
354
|
+
0x1021: leal 0x6789(%edi), %eax
|
355
|
+
Prefix:0x00 0x00 0x00 0x00
|
356
|
+
Opcode:0x8d 0x00 0x00 0x00
|
357
|
+
rex: 0x0
|
358
|
+
addr_size: 4
|
359
|
+
modrm: 0x87
|
360
|
+
disp: 0x6789
|
361
|
+
sib: 0x0
|
362
|
+
op_count: 2
|
363
|
+
operands[0].type: MEM
|
364
|
+
operands[0].mem.base: REG = edi
|
365
|
+
operands[0].mem.disp: 0x6789
|
366
|
+
operands[0].size: 4
|
367
|
+
operands[1].type: REG = eax
|
368
|
+
operands[1].size: 4
|
369
|
+
|
370
|
+
0x1027: movb $-0x3a, %ah
|
371
|
+
Prefix:0x00 0x00 0x00 0x00
|
372
|
+
Opcode:0xb4 0x00 0x00 0x00
|
373
|
+
rex: 0x0
|
374
|
+
addr_size: 4
|
375
|
+
modrm: 0x0
|
376
|
+
disp: 0x0
|
377
|
+
sib: 0x0
|
378
|
+
imm_count: 1
|
379
|
+
imms[1]: 0xffffffffffffffc6
|
380
|
+
op_count: 2
|
381
|
+
operands[0].type: IMM = 0xffffffffffffffc6
|
382
|
+
operands[0].size: 1
|
383
|
+
operands[1].type: REG = ah
|
384
|
+
operands[1].size: 1
|
385
|
+
|
386
|
+
0x1029:
|
387
|
+
|
388
|
+
****************
|
389
|
+
Platform: X86 32 (Intel syntax)
|
390
|
+
Code:0x8d 0x4c 0x32 0x08 0x01 0xd8 0x81 0xc6 0x34 0x12 0x00 0x00 0x05 0x23 0x01 0x00 0x00 0x36 0x8b 0x84 0x91 0x23 0x01 0x00 0x00 0x41 0x8d 0x84 0x39 0x89 0x67 0x00 0x00 0x8d 0x87 0x89 0x67 0x00 0x00 0xb4 0xc6
|
391
|
+
Disasm:
|
392
|
+
0x1000: lea ecx, dword ptr [edx + esi + 8]
|
393
|
+
Prefix:0x00 0x00 0x00 0x00
|
394
|
+
Opcode:0x8d 0x00 0x00 0x00
|
395
|
+
rex: 0x0
|
396
|
+
addr_size: 4
|
397
|
+
modrm: 0x4c
|
398
|
+
disp: 0x8
|
399
|
+
sib: 0x32
|
400
|
+
sib_base: edx
|
401
|
+
sib_index: esi
|
402
|
+
sib_scale: 1
|
403
|
+
op_count: 2
|
404
|
+
operands[0].type: REG = ecx
|
405
|
+
operands[0].size: 4
|
406
|
+
operands[1].type: MEM
|
407
|
+
operands[1].mem.base: REG = edx
|
408
|
+
operands[1].mem.index: REG = esi
|
409
|
+
operands[1].mem.disp: 0x8
|
410
|
+
operands[1].size: 4
|
411
|
+
|
412
|
+
0x1004: add eax, ebx
|
413
|
+
Prefix:0x00 0x00 0x00 0x00
|
414
|
+
Opcode:0x01 0x00 0x00 0x00
|
415
|
+
rex: 0x0
|
416
|
+
addr_size: 4
|
417
|
+
modrm: 0xd8
|
418
|
+
disp: 0x0
|
419
|
+
sib: 0x0
|
420
|
+
op_count: 2
|
421
|
+
operands[0].type: REG = eax
|
422
|
+
operands[0].size: 4
|
423
|
+
operands[1].type: REG = ebx
|
424
|
+
operands[1].size: 4
|
425
|
+
|
426
|
+
0x1006: add esi, 0x1234
|
427
|
+
Prefix:0x00 0x00 0x00 0x00
|
428
|
+
Opcode:0x81 0x00 0x00 0x00
|
429
|
+
rex: 0x0
|
430
|
+
addr_size: 4
|
431
|
+
modrm: 0xc6
|
432
|
+
disp: 0x0
|
433
|
+
sib: 0x0
|
434
|
+
imm_count: 1
|
435
|
+
imms[1]: 0x1234
|
436
|
+
op_count: 2
|
437
|
+
operands[0].type: REG = esi
|
438
|
+
operands[0].size: 4
|
439
|
+
operands[1].type: IMM = 0x1234
|
440
|
+
operands[1].size: 4
|
441
|
+
|
442
|
+
0x100c: add eax, 0x123
|
443
|
+
Prefix:0x00 0x00 0x00 0x00
|
444
|
+
Opcode:0x05 0x00 0x00 0x00
|
445
|
+
rex: 0x0
|
446
|
+
addr_size: 4
|
447
|
+
modrm: 0x0
|
448
|
+
disp: 0x0
|
449
|
+
sib: 0x0
|
450
|
+
imm_count: 1
|
451
|
+
imms[1]: 0x123
|
452
|
+
op_count: 2
|
453
|
+
operands[0].type: REG = eax
|
454
|
+
operands[0].size: 4
|
455
|
+
operands[1].type: IMM = 0x123
|
456
|
+
operands[1].size: 4
|
457
|
+
|
458
|
+
0x1011: mov eax, dword ptr ss:[ecx + edx*4 + 0x123]
|
459
|
+
Prefix:0x00 0x36 0x00 0x00
|
460
|
+
Opcode:0x8b 0x00 0x00 0x00
|
461
|
+
rex: 0x0
|
462
|
+
addr_size: 4
|
463
|
+
modrm: 0x84
|
464
|
+
disp: 0x123
|
465
|
+
sib: 0x91
|
466
|
+
sib_base: ecx
|
467
|
+
sib_index: edx
|
468
|
+
sib_scale: 4
|
469
|
+
op_count: 2
|
470
|
+
operands[0].type: REG = eax
|
471
|
+
operands[0].size: 4
|
472
|
+
operands[1].type: MEM
|
473
|
+
operands[1].mem.segment: REG = ss
|
474
|
+
operands[1].mem.base: REG = ecx
|
475
|
+
operands[1].mem.index: REG = edx
|
476
|
+
operands[1].mem.scale: 4
|
477
|
+
operands[1].mem.disp: 0x123
|
478
|
+
operands[1].size: 4
|
479
|
+
|
480
|
+
0x1019: inc ecx
|
481
|
+
Prefix:0x00 0x00 0x00 0x00
|
482
|
+
Opcode:0x41 0x00 0x00 0x00
|
483
|
+
rex: 0x0
|
484
|
+
addr_size: 4
|
485
|
+
modrm: 0x0
|
486
|
+
disp: 0x0
|
487
|
+
sib: 0x0
|
488
|
+
op_count: 1
|
489
|
+
operands[0].type: REG = ecx
|
490
|
+
operands[0].size: 4
|
491
|
+
|
492
|
+
0x101a: lea eax, dword ptr [ecx + edi + 0x6789]
|
493
|
+
Prefix:0x00 0x00 0x00 0x00
|
494
|
+
Opcode:0x8d 0x00 0x00 0x00
|
495
|
+
rex: 0x0
|
496
|
+
addr_size: 4
|
497
|
+
modrm: 0x84
|
498
|
+
disp: 0x6789
|
499
|
+
sib: 0x39
|
500
|
+
sib_base: ecx
|
501
|
+
sib_index: edi
|
502
|
+
sib_scale: 1
|
503
|
+
op_count: 2
|
504
|
+
operands[0].type: REG = eax
|
505
|
+
operands[0].size: 4
|
506
|
+
operands[1].type: MEM
|
507
|
+
operands[1].mem.base: REG = ecx
|
508
|
+
operands[1].mem.index: REG = edi
|
509
|
+
operands[1].mem.disp: 0x6789
|
510
|
+
operands[1].size: 4
|
511
|
+
|
512
|
+
0x1021: lea eax, dword ptr [edi + 0x6789]
|
513
|
+
Prefix:0x00 0x00 0x00 0x00
|
514
|
+
Opcode:0x8d 0x00 0x00 0x00
|
515
|
+
rex: 0x0
|
516
|
+
addr_size: 4
|
517
|
+
modrm: 0x87
|
518
|
+
disp: 0x6789
|
519
|
+
sib: 0x0
|
520
|
+
op_count: 2
|
521
|
+
operands[0].type: REG = eax
|
522
|
+
operands[0].size: 4
|
523
|
+
operands[1].type: MEM
|
524
|
+
operands[1].mem.base: REG = edi
|
525
|
+
operands[1].mem.disp: 0x6789
|
526
|
+
operands[1].size: 4
|
527
|
+
|
528
|
+
0x1027: mov ah, -0x3a
|
529
|
+
Prefix:0x00 0x00 0x00 0x00
|
530
|
+
Opcode:0xb4 0x00 0x00 0x00
|
531
|
+
rex: 0x0
|
532
|
+
addr_size: 4
|
533
|
+
modrm: 0x0
|
534
|
+
disp: 0x0
|
535
|
+
sib: 0x0
|
536
|
+
imm_count: 1
|
537
|
+
imms[1]: 0xffffffffffffffc6
|
538
|
+
op_count: 2
|
539
|
+
operands[0].type: REG = ah
|
540
|
+
operands[0].size: 1
|
541
|
+
operands[1].type: IMM = 0xffffffffffffffc6
|
542
|
+
operands[1].size: 1
|
543
|
+
|
544
|
+
0x1029:
|
545
|
+
|
546
|
+
****************
|
547
|
+
Platform: X86 64 (Intel syntax)
|
548
|
+
Code:0x55 0x48 0x8b 0x05 0xb8 0x13 0x00 0x00
|
549
|
+
Disasm:
|
550
|
+
0x1000: push rbp
|
551
|
+
Prefix:0x00 0x00 0x00 0x00
|
552
|
+
Opcode:0x55 0x00 0x00 0x00
|
553
|
+
rex: 0x0
|
554
|
+
addr_size: 8
|
555
|
+
modrm: 0x0
|
556
|
+
disp: 0x0
|
557
|
+
sib: 0x0
|
558
|
+
op_count: 1
|
559
|
+
operands[0].type: REG = rbp
|
560
|
+
operands[0].size: 8
|
561
|
+
|
562
|
+
0x1001: mov rax, qword ptr [rip + 0x13b8]
|
563
|
+
Prefix:0x00 0x00 0x00 0x00
|
564
|
+
Opcode:0x8b 0x00 0x00 0x00
|
565
|
+
rex: 0x48
|
566
|
+
addr_size: 8
|
567
|
+
modrm: 0x5
|
568
|
+
disp: 0x13b8
|
569
|
+
sib: 0x0
|
570
|
+
op_count: 2
|
571
|
+
operands[0].type: REG = rax
|
572
|
+
operands[0].size: 8
|
573
|
+
operands[1].type: MEM
|
574
|
+
operands[1].mem.base: REG = rip
|
575
|
+
operands[1].mem.disp: 0x13b8
|
576
|
+
operands[1].size: 8
|
577
|
+
|
578
|
+
0x1008:
|
579
|
+
|