Permalink
Browse files

Added a makefile for Java for Mac/Linux, thanks to Richard Zak.

Fixed some move/transactional instructions.
Changed license to BSD, Woo!
Bumped version to 3.3.3, should work on PIP now.
  • Loading branch information...
1 parent ac277fb commit 938e6ace4afdbc8b7b6f83d03efcd00dd52301e6 gil_dabah committed May 28, 2016
View
Oops, something went wrong.
View
@@ -9,4 +9,4 @@ diStorm3 is super lightweight (~45KB), ultra fast and easy to use (a single API)
"We benchmarked five popular open-source disassembly libraries and chose diStorm3, which had the best performance (and furthermore, has complete 64-bit support).", July 2014, Quoting David Williams-King in his Thesis about Binary Shuffling.
->diStorm3.3 is now available for <i>commercial</i> use, http://ragestorm.net/distorm/.
+diStorm3.3.3 is now licensed under BSD!
View
@@ -112,21 +112,21 @@ def CreatePythonDict(mnemonicsIds):
s += "0x%x: \"%s\", " % (mnemonicsIds[i], i)
if len(s) - s.rfind("\n") >= 76:
s = s[:-1] + "\n"
- print s
+ open("python_output.txt", "w").write(s)
def CreateJavaDict(mnemonicsIds):
""" Create the opcodes dictionary/enum for Java. """
s = "\nmOpcodes.put(0, OpcodeEnum.UNDEFINED);\n"
for i in mnemonicsIds:
s += "mOpcodes.put(0x%x, OpcodeEnum.%s);\n" % (mnemonicsIds[i], i.replace(" ", "_").replace(",", ""))
- print s
+ open("java_enums.txt", "w").write(s)
s = "\nUNDEFINED, "
for i in mnemonicsIds:
s += "%s, " % (i.replace(" ", "_").replace(",", ""))
if len(s) - s.rfind("\n") >= 76:
s = s[:-1] + "\n"
- print s
+ open("java_mnemonics.txt", "w").write(s)
def DumpMnemonics():
global mnemonicsIds
@@ -191,8 +191,8 @@ def DumpMnemonics():
f.close()
# Used for Python/Java dictionary of opcodeIds-->mnemonics.
- #CreatePythonDict(mnemonicsIds)
- #CreateJavaDict(mnemonicsIds)
+ CreatePythonDict(mnemonicsIds)
+ CreateJavaDict(mnemonicsIds)
O_NONE = 0
# REG standalone
View
@@ -343,8 +343,8 @@ def init_INTEGER(self):
Set("c3", ["RET"], [], IFlag._64BITS)
Set("c4", ["LES"], [OPT.REG_FULL, OPT.MEM16_FULL], IFlag.MODRM_REQUIRED | IFlag.INVALID_64BITS)
Set("c5", ["LDS"], [OPT.REG_FULL, OPT.MEM16_FULL], IFlag.MODRM_REQUIRED | IFlag.INVALID_64BITS)
- Set("c6 //00", ["MOV"], [OPT.RM8, OPT.IMM8], IFlag.MODRM_REQUIRED)
- Set("c7 //00", ["MOV"], [OPT.RM_FULL, OPT.IMM_FULL], IFlag.MODRM_REQUIRED)
+ Set("c6 //00", ["MOV"], [OPT.RM8, OPT.IMM8], IFlag.MODRM_REQUIRED | IFlag.NOT_DIVIDED)
+ Set("c7 //00", ["MOV"], [OPT.RM_FULL, OPT.IMM_FULL], IFlag.MODRM_REQUIRED | IFlag.NOT_DIVIDED)
Set("c8", ["ENTER"], [OPT.IMM16_1, OPT.IMM8_2], IFlag._64BITS)
Set("c9", ["LEAVE"], [], IFlag._64BITS)
@@ -0,0 +1,23 @@
+UNAME_S := $(shell uname -s)
+
+ifeq ($(UNAME_S),Darwin)
+
+JAVA_HOME=$(shell /usr/libexec/java_home)
+
+all: libjdistorm.dylib
+libjdistorm.dylib: jdistorm.c jdistorm.h
+ gcc -dynamiclib -o libjdistorm.dylib jdistorm.c -I ${JAVA_HOME}/include/ -I ${JAVA_HOME}/include/darwin/ -ldistorm3
+
+endif
+
+ifeq ($(UNAME_S),Linux)
+
+all: libjdistorm.so
+jdistorm.o: jdistorm.c jdistorm.h
+ gcc -c jdistorm.c -fPIC -I ${JAVA_HOME}/include -I ${JAVA_HOME}/include/linux
+
+libjdistorm.so: jdistorm.o
+ gcc -shared -o libjdistorm.so -L${JAVA_HOME}/jre/lib -ldistorm3 jdistorm.o
+
+endif
+
@@ -13,61 +13,61 @@
PHSUBW, CMPEQSD, XADD, CMOVBE, CMP, SBB, VHADDPS, FXRSTOR64, INVVPID, LSL,
VCMPNEQ_USSS, VHADDPD, LSS, VFMSUB132PD, LAHF, PFACC, PFRCPIT2, VPUNPCKLBW,
PFRCPIT1, PCMPGTQ, FYL2X, VCMPORD_SSD, PSRLD, SFENCE, CVTPS2DQ, PBLENDW, VFMSUBADD213PS,
- VPINSRB, PCMPGTB, PCMPGTD, VAESENC, VMOVSHDUP, MPSADBW, VCMPNLE_UQPD, VMMCALL,
- INSERTQ, VFNMADD213SS, CVTPI2PD, INT, VPERMILPS, HLT, PHMINPOSUW, FCMOVNU,
- INVPCID, INS, FCOMIP, CVTPI2PS, VFNMADD213SD, PACKUSWB, CBW, VMSAVE, PUSHF,
- NOT, FCMOVNB, NOP, FSQRT, VPERMILPD, INC, UD2, VPCMPEQW, PCMPISTRM, VPCMPEQQ,
- CMPNLEPS, VCMPEQ_USSD, VCMPUNORDPD, FADDP, RET, VPCMPEQD, VPMINSD, VPCMPEQB,
- ADDSUBPD, VFMADDSUB231PS, VCMPEQ_USSS, PSIGNW, VPMOVSXDQ, VPMAXSD, SETG, VPMAXSB,
- SETA, SETB, STMXCSR, SETL, MOVNTQ, SETO, ANDNPD, BSR, VMOVDDUP, VPMAXSW, PSIGND,
- SETP, PSIGNB, LFS, SETS, VCMPUNORDSS, ANDNPS, VMXON, VANDPS, XSETBV, OUT, LTR,
- VPINSRD, TZCNT, VCVTTSS2SI, VPSRLDQ, FDECSTP, PSRLDQ, VCMPGE_OQSD, PSLLDQ,
- FCOS, FXTRACT, VCMPGE_OQSS, VMOVNTDQA, VCMPNGT_UQPD, FMUL, VCMPGT_OQPS, FCOMPP,
- PF2ID, CWD, VCMPUNORD_SPS, CMOVLE, VPSHUFHW, VCMPGT_OQPD, PHADDSW, PF2IW, VMOVNTPD,
- FCOMP, UNPCKLPS, MASKMOVDQU, FCMOVBE, VCMPLT_OQPD, VMAXSD, VCMPNLTPD, PREFETCHT2,
- PREFETCHT1, PREFETCHT0, UNPCKLPD, CVTTSS2SI, DIV, PMOVSXDQ, VCMPGESS, CDQE,
- VSTMXCSR, FISUBR, VPMINSB, VFMSUB213PS, VCMPLT_OQPS, CMPLESS, VPMINSW, FSTENV,
- VCMPGESD, VPTEST, FISUB, STD, VPACKSSDW, XOR, VMULPD, STC, STI, LDMXCSR, CMPLTPD,
- ORPS, VPACKUSDW, FSUBP, STR, FSUBR, CMPLTPS, VFMADD231SD, PAUSE, CVTPD2DQ,
- RSM, VSQRTSD, VORPS, VFMADDSUB213PS, AESENC, VCMPEQ_UQPD, VUNPCKHPS, PMADDUBSW,
- VCMPNLE_UQPS, VPSLLW, MASKMOVQ, CALL, VSQRTSS, PADDUSB, VMREAD, XSAVEOPT64,
- VUNPCKHPD, VSUBPS, VCVTSS2SD, VAESDECLAST, HSUBPS, VCVTSS2SI, VPBLENDVB, VCMPGTSD,
- FILD, VCOMISS, HSUBPD, VFNMSUB231SS, VPSRAD, VCMPNLEPS, SAL, SYSCALL, VRSQRTSS,
- VPINSRQ, WRGSBASE, VPSHUFD, PMOVSXBW, VPSRAW, VCMPNLEPD, FADD, SAR, XEND, AESKEYGENASSIST,
- PACKSSDW, VFMADD213SS, VMOVDQA, VMOVSLDUP, FRNDINT, PMULLW, DIVSD, MOVMSKPS,
- VPMAXUW, VDIVPD, VPMOVSXBW, PMOVSXWQ, PMULLD, VMOVDQU, VFNMSUB213SD, CMOVAE,
- VCMPEQ_OSPD, VDIVPS, JAE, MOVMSKPD, DIVSS, FSAVE, PCMPEQQ, VPSHUFLW, PCMPEQW,
- VLDMXCSR, VFMSUB132SS, CMPORDPD, RCPSS, VPSLLD, IDIV, VCMPORDPD, PCMPEQB, PCMPEQD,
- VPSLLQ, VPMOVZXBQ, VFMSUBADD213PD, VBLENDVPD, CMPORDPS, PUNPCKLQDQ, VPAND,
- VCMPNEQ_OQPD, HADDPD, VADDSUBPS, VSHUFPD, VSUBSD, VSQRTPS, MOVSHDUP, VFNMADD231SD,
- VMLAUNCH, VMASKMOVPD, HADDPS, VCMPNEQ_OQPS, PUNPCKLWD, VCMPNGT_UQSS, VSQRTPD,
- VSUBSS, VSHUFPS, VCMPNEQSS, VLDDQU, VCMPLT_OQSS, RDRAND, PADDSW, VCMPEQ_USPS,
- ORPD, PANDN, FPTAN, FIDIV, VCMPLT_OQSD, VMPTRLD, VFMSUB231PS, VCMPNEQSD, VPMULDQ,
- LOOPNZ, VCMPUNORDPS, SHR, SHRD, MONITOR, XABORT, AESENCLAST, MOVSD, VPINSRW,
- VMLOAD, MOVLHPS, VMOVLPD, MOVQ2DQ, SQRTSS, VDPPS, SUBSS, MOVSX, VMOVLHPS, VMOVLPS,
- VPUNPCKHDQ, VCVTPD2DQ, SHL, MOVSS, PINSRQ, PFNACC, MOVDQU, OUTS, PSUBB, BTS,
- BTR, VCMPNEQ_USSD, SGDT, VFMADD231SS, FSCALE, PSUBW, CMPNLTPD, PACKUSDW, LAR,
- BTC, VFNMADD132SD, VCMPNGTPD, VPMOVZXBW, VFMSUB132SD, AESIMC, FCOM, VPMOVZXBD,
- VADDSUBPD, FINIT, CMPORDSS, WBINVD, PAND, VPALIGNR, CMPORDSD, VPXOR, JBE, FXAM,
- XSAVEOPT, MUL, VPMINUB, VPADDSW, PMAXSW, VINSERTPS, VCMPEQPD, FFREE, VMASKMOVPS,
- CMPXCHG8B, PMAXSD, VPADDSB, PUSH, VPCLMULQDQ, VCMPEQPS, PFRSQIT1, ROUNDPS,
- SETNO, XGETBV, PMINSD, PADDB, FPREM1, CLD, FIMUL, XORPD, CLC, FSTP, BLENDPD,
- PADDUSW, FNINIT, SETNZ, PADDQ, XORPS, VFNMSUB213SS, SETNS, FIADD, SETNP, VPUNPCKHQDQ,
- SUBPS, CMPNLTSD, LLDT, VFMSUB213SD, PTEST, VFNMSUB132PD, GETSEC, VPSIGND, JCXZ,
- CMPNLTSS, SETGE, CMPEQPS, PSADBW, MOVSXD, VFNMSUB132PS, AAD, VAESENCLAST, PUNPCKHQDQ,
- MOVLPD, VPADDUSW, VCMPFALSEPS, AAM, VPUNPCKLQDQ, MINSS, PADDD, VCMPFALSEPD,
- VPUNPCKLWD, MOVLPS, CLGI, AAS, LODS, CMOVNP, MINSD, CLI, CVTTSD2SI, FICOM,
- PMOVZXBW, ADDPD, PREFETCHW, VCMPNEQ_USPS, VXORPD, POR, POP, VPERM2F128, LOOPZ,
- MOVNTDQ, INT1, CMPXCHG, VBROADCASTF128, VCMPNGE_UQPD, PHADDW, VXORPS, VCMPNEQ_USPD,
- ADDPS, PFMUL, LGDT, VERR, VERW, VHSUBPD, VPMULLW, VMOVUPS, INTO, FCLEX, VHSUBPS,
- CVTSD2SS, FLDPI, PABSW, VMAXPD, JMP_FAR, VPACKUSWB, FUCOMPP, VMOVUPD, PSWAPD,
- VROUNDSD, PADDW, PSLLD, SWAPGS, MOVSLDUP, CVTSI2SS, VCMPTRUESD, CMPUNORDSS,
- VCVTTPS2DQ, SQRTSD, VBROADCASTSD, PSUBD, TEST, LGS, VCMPTRUESS, SYSENTER, CVTSI2SD,
- VCMPNLESD, VTESTPD, JZ, VDIVSS, VORPD, JP, JS, JL, RSQRTSS, VTESTPS, JO, VMAXPS,
- PSUBUSB, JG, VBROADCASTSS, JA, JB, CWDE, VCMPLEPD, VMWRITE, VCMPLEPS, PMOVMSKB,
- INSERTPS, PCMPESTRI, WAIT, VCMPFALSE_OSPD, PCMPESTRM, PUNPCKLDQ, MULSS, VSUBPD,
- CMPEQPD, VCMPNEQ_OQSD, VCOMISD, VMINSS, VPADDD, RDMSR, VPSIGNW, JECXZ, MULSD,
- ENTER, MOVBE, VZEROALL, _3DNOW, VMINSD, VCMPNEQ_OQSS, PFSUBR, VCMPGEPS, VPSUBUSB,
+ PCMPGTB, PCMPGTD, VAESENC, VMOVSHDUP, MPSADBW, VCMPNLE_UQPD, VMMCALL, INSERTQ,
+ VFNMADD213SS, CVTPI2PD, INT, VPERMILPS, HLT, PHMINPOSUW, FCMOVNU, INVPCID,
+ INS, FCOMIP, CVTPI2PS, VFNMADD213SD, PACKUSWB, CBW, VMSAVE, PUSHF, NOT, FCMOVNB,
+ NOP, FSQRT, VPERMILPD, INC, UD2, VPCMPEQW, PCMPISTRM, VPCMPEQQ, CMPNLEPS, VCMPEQ_USSD,
+ VCMPUNORDPD, FADDP, RET, VPCMPEQD, VPMINSD, VPINSRB, VPCMPEQB, ADDSUBPD, VFMADDSUB231PS,
+ VCMPEQ_USSS, PSIGNW, VPMOVSXDQ, VPMAXSD, SETG, VPMAXSB, SETA, SETB, STMXCSR,
+ SETL, MOVNTQ, SETO, ANDNPD, BSR, VMOVDDUP, VPMAXSW, PSIGND, SETP, PSIGNB, LFS,
+ SETS, VCMPUNORDSS, ANDNPS, VMXON, VANDPS, XSETBV, OUT, LTR, VPINSRD, TZCNT,
+ VCVTTSS2SI, VPSRLDQ, FDECSTP, PSRLDQ, VCMPGE_OQSD, PSLLDQ, FCOS, FXTRACT, VCMPGE_OQSS,
+ VMOVNTDQA, VCMPNGT_UQPD, FMUL, VCMPGT_OQPS, FCOMPP, PF2ID, CWD, VCMPUNORD_SPS,
+ CMOVLE, VPSHUFHW, VCMPGT_OQPD, PHADDSW, PF2IW, VMOVNTPD, FCOMP, UNPCKLPS, MASKMOVDQU,
+ FCMOVBE, VCMPLT_OQPD, VMAXSD, VCMPNLTPD, PREFETCHT2, PREFETCHT1, PREFETCHT0,
+ UNPCKLPD, CVTTSS2SI, DIV, PMOVSXDQ, VCMPGESS, CDQE, VSTMXCSR, FISUBR, VPMINSB,
+ VFMSUB213PS, VCMPLT_OQPS, CMPLESS, VPMINSW, FSTENV, VCMPGESD, VPTEST, FISUB,
+ STD, VPACKSSDW, XOR, VMULPD, STC, STI, LDMXCSR, CMPLTPD, ORPS, VPACKUSDW, FSUBP,
+ STR, FSUBR, CMPLTPS, VFMADD231SD, PAUSE, CVTPD2DQ, RSM, VSQRTSD, VORPS, VFMADDSUB213PS,
+ AESENC, VCMPEQ_UQPD, VUNPCKHPS, PMADDUBSW, VCMPNLE_UQPS, VPSLLW, MASKMOVQ,
+ CALL, VSQRTSS, PADDUSB, VMREAD, XSAVEOPT64, VUNPCKHPD, VSUBPS, VCVTSS2SD, VAESDECLAST,
+ HSUBPS, VCVTSS2SI, VPBLENDVB, VCMPGTSD, FILD, VCOMISS, HSUBPD, VFNMSUB231SS,
+ VPSRAD, VCMPNLEPS, SAL, SYSCALL, VRSQRTSS, VPINSRQ, WRGSBASE, VPSHUFD, PMOVSXBW,
+ VPSRAW, VCMPNLEPD, FADD, SAR, XEND, AESKEYGENASSIST, PACKSSDW, VFMADD213SS,
+ VMOVDQA, VMOVSLDUP, FRNDINT, PMULLW, DIVSD, MOVMSKPS, VPMAXUW, VDIVPD, VPMOVSXBW,
+ PMOVSXWQ, PMULLD, VMOVDQU, VFNMSUB213SD, CMOVAE, VCMPEQ_OSPD, VDIVPS, JAE,
+ MOVMSKPD, DIVSS, FSAVE, PCMPEQQ, VPSHUFLW, PCMPEQW, VLDMXCSR, VFMSUB132SS,
+ CMPORDPD, RCPSS, VPSLLD, IDIV, VCMPORDPD, PCMPEQB, PCMPEQD, VPSLLQ, VPMOVZXBQ,
+ VFMSUBADD213PD, VBLENDVPD, CMPORDPS, PUNPCKLQDQ, VPAND, VCMPNEQ_OQPD, HADDPD,
+ VADDSUBPS, VSHUFPD, VSUBSD, VSQRTPS, MOVSHDUP, VFNMADD231SD, VMLAUNCH, VMASKMOVPD,
+ HADDPS, VCMPNEQ_OQPS, PUNPCKLWD, VCMPNGT_UQSS, VSQRTPD, VSUBSS, VSHUFPS, VCMPNEQSS,
+ VLDDQU, VCMPLT_OQSS, RDRAND, PADDSW, VCMPEQ_USPS, ORPD, PANDN, FPTAN, FIDIV,
+ VCMPLT_OQSD, VMPTRLD, VFMSUB231PS, VCMPNEQSD, VPMULDQ, LOOPNZ, VCMPUNORDPS,
+ SHR, SHRD, MONITOR, XABORT, AESENCLAST, MOVSD, VPINSRW, VMLOAD, MOVLHPS, VMOVLPD,
+ MOVQ2DQ, SQRTSS, VDPPS, SUBSS, MOVSX, VMOVLHPS, VMOVLPS, VPUNPCKHDQ, VCVTPD2DQ,
+ SHL, MOVSS, PINSRQ, PFNACC, MOVDQU, OUTS, PSUBB, BTS, BTR, VCMPNEQ_USSD, SGDT,
+ VFMADD231SS, FSCALE, PSUBW, CMPNLTPD, PACKUSDW, LAR, BTC, VFNMADD132SD, VCMPNGTPD,
+ VPMOVZXBW, VFMSUB132SD, AESIMC, FCOM, VPMOVZXBD, VADDSUBPD, FINIT, CMPORDSS,
+ WBINVD, PAND, VPALIGNR, CMPORDSD, VPXOR, JBE, FXAM, XSAVEOPT, MUL, VPMINUB,
+ VPADDSW, PMAXSW, VINSERTPS, VCMPEQPD, FFREE, VMASKMOVPS, CMPXCHG8B, PMAXSD,
+ VPADDSB, PUSH, VPCLMULQDQ, VCMPEQPS, PFRSQIT1, ROUNDPS, SETNO, XGETBV, PMINSD,
+ PADDB, FPREM1, CLD, FIMUL, XORPD, CLC, FSTP, BLENDPD, PADDUSW, FNINIT, SETNZ,
+ PADDQ, XORPS, VFNMSUB213SS, SETNS, FIADD, SETNP, VPUNPCKHQDQ, SUBPS, CMPNLTSD,
+ LLDT, VFMSUB213SD, PTEST, VFNMSUB132PD, GETSEC, VPSIGND, JCXZ, CMPNLTSS, SETGE,
+ CMPEQPS, PSADBW, MOVSXD, VFNMSUB132PS, AAD, VAESENCLAST, PUNPCKHQDQ, MOVLPD,
+ VPADDUSW, VCMPFALSEPS, AAM, VPUNPCKLQDQ, MINSS, PADDD, VCMPFALSEPD, VPUNPCKLWD,
+ MOVLPS, CLGI, AAS, LODS, CMOVNP, MINSD, CLI, CVTTSD2SI, FICOM, PMOVZXBW, ADDPD,
+ PREFETCHW, VCMPNEQ_USPS, VXORPD, POR, POP, VPERM2F128, LOOPZ, MOVNTDQ, INT1,
+ CMPXCHG, VBROADCASTF128, VCMPNGE_UQPD, PHADDW, VXORPS, VCMPNEQ_USPD, ADDPS,
+ PFMUL, LGDT, VERR, VERW, VHSUBPD, VPMULLW, VMOVUPS, INTO, FCLEX, VHSUBPS, CVTSD2SS,
+ FLDPI, PABSW, VMAXPD, JMP_FAR, VPACKUSWB, FUCOMPP, VMOVUPD, PSWAPD, PADDW,
+ PSLLD, SWAPGS, MOVSLDUP, CVTSI2SS, VCMPTRUESD, CMPUNORDSS, VCVTTPS2DQ, SQRTSD,
+ VBROADCASTSD, PSUBD, TEST, LGS, VCMPTRUESS, SYSENTER, CVTSI2SD, VCMPNLESD,
+ VTESTPD, JZ, VDIVSS, VORPD, JP, JS, JL, RSQRTSS, VTESTPS, JO, VMAXPS, PSUBUSB,
+ JG, VBROADCASTSS, JA, JB, CWDE, VCMPLEPD, VMWRITE, VCMPLEPS, PMOVMSKB, INSERTPS,
+ PCMPESTRI, WAIT, VCMPFALSE_OSPD, PCMPESTRM, PUNPCKLDQ, MULSS, VSUBPD, CMPEQPD,
+ VCMPNEQ_OQSD, VCOMISD, VMINSS, VPADDD, RDMSR, VPSIGNW, JECXZ, MULSD, ENTER,
+ MOVBE, VZEROALL, _3DNOW, VMINSD, VCMPNEQ_OQSS, PFSUBR, VCMPGEPS, VPSUBUSB,
VFMSUB231SD, PMAXUD, FXSAVE, FISTTP, VCMPGEPD, BLENDPS, VCMPLESD, FCMOVNBE,
VFMSUB231SS, VBLENDVPS, VMPSADBW, VPSUBUSW, VCMPLTSD, MOVNTDQA, SHUFPD, SUBPD,
SQRTPD, VMOVHPD, VMCALL, VFMADD132PD, LEAVE, SHUFPS, VCMPEQ_OSPS, VPCMPESTRI,
@@ -96,8 +96,8 @@
CMOVNO, VPMULHW, VPSRLD, CVTPS2PH, CVTPS2PI, PHADDD, CVTPS2PD, VPABSW, VCMPLE_OQSD,
VMOVAPS, VPSUBW, PMULHRW, MOVAPS, PFMIN, MOVD, MOVHPS, MULPS, VCMPLTPS, BT,
MOVAPD, VCMPNGE_UQPS, JRCXZ, MULPD, MOVS, INVLPG, MOVQ, VMINPD, PABSD, SAHF,
- VCMPTRUE_USPS, PI2FD, PABSB, VPANDN, VPUNPCKLDQ, FDIVP, PSUBQ, FDIVR, FDIV,
- VCMPTRUE_USPD, PREFETCH, EMMS, VMINPS, VFMADD231PS, VFNMSUB213PD, CVTSS2SI,
+ VCMPTRUE_USPS, PI2FD, PABSB, VROUNDSD, VPANDN, VPUNPCKLDQ, FDIVP, PSUBQ, FDIVR,
+ FDIV, VCMPTRUE_USPD, PREFETCH, EMMS, VMINPS, VFMADD231PS, VFNMSUB213PD, CVTSS2SI,
MOVHPD, CMOVZ, VPAVGW, CQO, VPSUBD, CMOVP, VCMPEQSS, CMOVS, PMOVSXBD, VROUNDSS,
VPSUBQ, CMOVL, ADDSUBPS, CMOVO, CMOVA, CMOVB, PUNPCKHBW, PCMPISTRI, CMOVG,
VPMOVMSKB, AESDECLAST, MOVUPD, VFMSUBADD132PD, VPSADBW, XBEGIN, VROUNDPD, LMSW,
@@ -119,7 +119,6 @@ public static OpcodeEnum lookup(int op)
mOpcodes.put(0xd0b, OpcodeEnum.CVTPS2DQ);
mOpcodes.put(0x24c5, OpcodeEnum.PBLENDW);
mOpcodes.put(0x21c4, OpcodeEnum.VFMSUBADD213PS);
- mOpcodes.put(0x2558, OpcodeEnum.VPINSRB);
mOpcodes.put(0xe8c, OpcodeEnum.PCMPGTB);
mOpcodes.put(0xeb2, OpcodeEnum.PCMPGTD);
mOpcodes.put(0x23ed, OpcodeEnum.VAESENC);
@@ -161,6 +160,7 @@ public static OpcodeEnum lookup(int op)
mOpcodes.put(0x145, OpcodeEnum.RET);
mOpcodes.put(0x1010, OpcodeEnum.VPCMPEQD);
mOpcodes.put(0x1fd9, OpcodeEnum.VPMINSD);
+ mOpcodes.put(0x2558, OpcodeEnum.VPINSRB);
mOpcodes.put(0xfea, OpcodeEnum.VPCMPEQB);
mOpcodes.put(0x1910, OpcodeEnum.ADDSUBPD);
mOpcodes.put(0x22bc, OpcodeEnum.VFMADDSUB231PS);
@@ -544,7 +544,6 @@ public static OpcodeEnum lookup(int op)
mOpcodes.put(0x581, OpcodeEnum.FUCOMPP);
mOpcodes.put(0x864, OpcodeEnum.VMOVUPD);
mOpcodes.put(0x82c, OpcodeEnum.PSWAPD);
- mOpcodes.put(0x2495, OpcodeEnum.VROUNDSD);
mOpcodes.put(0x1c49, OpcodeEnum.PADDW);
mOpcodes.put(0x1b86, OpcodeEnum.PSLLD);
mOpcodes.put(0x756, OpcodeEnum.SWAPGS);
@@ -857,6 +856,7 @@ public static OpcodeEnum lookup(int op)
mOpcodes.put(0x13e7, OpcodeEnum.VCMPTRUE_USPS);
mOpcodes.put(0x782, OpcodeEnum.PI2FD);
mOpcodes.put(0x1e1e, OpcodeEnum.PABSB);
+ mOpcodes.put(0x2495, OpcodeEnum.VROUNDSD);
mOpcodes.put(0x1a26, OpcodeEnum.VPANDN);
mOpcodes.put(0xe6b, OpcodeEnum.VPUNPCKLDQ);
mOpcodes.put(0x63a, OpcodeEnum.FDIVP);
@@ -23,11 +23,17 @@ int main(int argc, char **argv)
unsigned int dver = distorm_version();
printf("diStorm version: %d.%d.%d\n", (dver >> 16), ((dver) >> 8) & 0xff, dver & 0xff);
- unsigned char rawData[] =
-{
- 0x55, 0x8b, 0xec ,0x8b ,0x45 ,0x08 ,0x03 ,0x45 ,0x0c ,0xc9 ,0xc3
+ unsigned char rawData[] = {
+
+ 0x68, 0, 0, 0, 0,
+ 0x9b,
+ 0xdf, 0xe0,
+ 0x66, 0xa1, 0xcc, 0xb0, 0x97, 0x7c,
+ 0xC7, 0xC1, 0x08, 0x00, 0x00, 0x00,
+ 0xc7, 0xf8, 0xaa, 0xaa, 0xaa, 0xaa,
+ 0x48, 0xC7, 0xC0, 0x00, 0x00, 0x00, 0x00
} ;
- res = distorm_decode(offset, (const unsigned char*)rawData, sizeof(rawData), Decode32Bits, decodedInstructions, MAX_INSTRUCTIONS, &decodedInstructionsCount);
+ res = distorm_decode(offset, (const unsigned char*)rawData, sizeof(rawData), Decode64Bits, decodedInstructions, MAX_INSTRUCTIONS, &decodedInstructionsCount);
for (int i = 0; i < decodedInstructionsCount; i++) {
printf("%08I64x (%02d) %-24s %s%s%s\r\n", decodedInstructions[i].offset, decodedInstructions[i].size, (char*)decodedInstructions[i].instructionHex.p, (char*)decodedInstructions[i].mnemonic.p, decodedInstructions[i].operands.length != 0 ? " " : "", (char*)decodedInstructions[i].operands.p);
}
@@ -43,7 +43,7 @@ def Assemble(text, mode):
mode = "amd64"
else:
mode = "x86"
- os.system("c:\\yasm.exe -m%s 1.asm" % mode)
+ os.system("yasm.exe -m%s 1.asm" % mode)
return open("1", "rb").read()
class InstBin(unittest.TestCase):
@@ -667,7 +667,8 @@ def test_imm8(self):
def test_imm16(self):
I64("ret 0x1122").check_imm(0, 0x1122, 16)
def test_imm_full(self):
- I64("push 0x12345678").check_imm(0, 0x12345678, 64)
+ I64("push 0x12345678").check_imm(0, 0x12345678, 32)
+ I64("mov rax, 0x1234567812345678").check_imm(1, 0x1234567812345678, 64)
def test_imm_aadm(self):
#I64("aam").check_imm(0, 0xa, 8)
#I64("aam 0x15").check_imm(0, 0x15, 8)
@@ -984,6 +985,21 @@ class TestInstTable(unittest.TestCase):
The bad tests should not find an instruction, so they should fail on purpose,
to see we don't crash the diassembler.
Also test for some end-cases with nop and wait. """
+ def test_c7_opcode(self):
+ IB32("c7f8aaaaaaaa").check_mnemonic("XBEGIN")
+ IB64("c7f8aaaaaaaa").check_mnemonic("XBEGIN")
+ IB32("C7C108000000").check_mnemonic("MOV")
+ IB64("C7C108000000").check_mnemonic("MOV")
+ IB64("48C7C000000000").check_mnemonic("MOV")
+ def test_tx(self):
+ IB64("0f01d5").check_mnemonic("XEND")
+ IB64("c6f8bb").check_mnemonic("XABORT")
+ IB64("c7f800000000").check_mnemonic("XBEGIN")
+ def test_fuzz_9b_and_c7(self):
+ for i in xrange(10000):
+ s = "%02x%02x" % (i & 0xff, random.randint(0, 255))
+ IB32("9b%sffffffff" % s)
+ IB32("c7%sffffffff" % s)
def test_ol1(self):
IB32("00c0").check_mnemonic("ADD")
def test_ol13(self):
View
@@ -1,25 +1,13 @@
-/* diStorm3 3.3 */
+/* diStorm 3.3.3 */
/*
distorm.h
diStorm3 - Powerful disassembler for X86/AMD64
http://ragestorm.net/distorm/
distorm at gmail dot com
-Copyright (C) 2003-2015 Gil Dabah
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>
+Copyright (C) 2003-2016 Gil Dabah
+This library is licensed under the BSD license. See the file COPYING.
*/
@@ -445,11 +433,7 @@ typedef enum { DECRES_NONE, DECRES_SUCCESS, DECRES_MEMORYERR, DECRES_INPUTERR, D
*/
/* distorm_decompose
- * There is lots of documentation about diStorm at https://code.google.com/p/distorm/wiki
- *
- * Please read https://code.google.com/p/distorm/wiki/DecomposeInterface
- *
- * And also see https://code.google.com/p/distorm/wiki/TipsnTricks
+ * See more documentation online at the GitHub project's wiki.
*
*/
#ifdef SUPPORT_64BIT_OFFSET
Oops, something went wrong.

0 comments on commit 938e6ac

Please sign in to comment.