Permalink
Browse files

Updated capstone to 93bfcf1

  • Loading branch information...
vit9696 committed Dec 3, 2017
1 parent eaab0d2 commit 952132dac7bff2cde1b44bcc8ed214e2c333fa3a
Showing with 1,917 additions and 1,863 deletions.
  1. +5 −0 .gitattributes
  2. +21 −11 capstone/.travis.yml
  3. +2 −2 capstone/MCInstrDesc.c
  4. +3 −3 capstone/MCInstrDesc.h
  5. +13 −13 capstone/MCRegisterInfo.c
  6. +19 −19 capstone/MCRegisterInfo.h
  7. +9 −4 capstone/Makefile
  8. +1 −1 capstone/SStream.c
  9. +1 −1 capstone/SStream.h
  10. +27 −27 capstone/arch/AArch64/AArch64BaseInfo.c
  11. +20 −20 capstone/arch/AArch64/AArch64BaseInfo.h
  12. +107 −107 capstone/arch/AArch64/AArch64Disassembler.c
  13. +14 −6 capstone/arch/AArch64/AArch64GenAsmWriter.inc
  14. +5 −5 capstone/arch/AArch64/AArch64GenDisassemblerTables.inc
  15. +90 −90 capstone/arch/AArch64/AArch64GenRegisterInfo.inc
  16. +12 −12 capstone/arch/AArch64/AArch64InstPrinter.c
  17. +6 −6 capstone/arch/AArch64/AArch64Mapping.c
  18. +2 −6 capstone/arch/AArch64/AArch64Module.c
  19. +2 −2 capstone/arch/ARM/ARMAddressingModes.h
  20. +6 −6 capstone/arch/ARM/ARMBaseInfo.h
  21. +6 −6 capstone/arch/ARM/ARMDisassembler.c
  22. +5 −5 capstone/arch/ARM/ARMGenAsmWriter.inc
  23. +17 −17 capstone/arch/ARM/ARMGenDisassemblerTables.inc
  24. +360 −360 capstone/arch/ARM/ARMGenInstrInfo.inc
  25. +204 −204 capstone/arch/ARM/ARMGenRegisterInfo.inc
  26. +4 −4 capstone/arch/ARM/ARMInstPrinter.c
  27. +7 −7 capstone/arch/ARM/ARMMapping.c
  28. +3 −7 capstone/arch/ARM/ARMModule.c
  29. +106 −107 capstone/arch/Mips/MipsDisassembler.c
  30. +4 −4 capstone/arch/Mips/MipsGenAsmWriter.inc
  31. +10 −10 capstone/arch/Mips/MipsGenDisassemblerTables.inc
  32. +100 −100 capstone/arch/Mips/MipsGenRegisterInfo.inc
  33. +5 −5 capstone/arch/Mips/MipsInstPrinter.c
  34. +5 −5 capstone/arch/Mips/MipsMapping.c
  35. +16 −9 capstone/arch/Mips/MipsModule.c
  36. +1 −1 capstone/arch/PowerPC/PPCDisassembler.c
  37. +4 −4 capstone/arch/PowerPC/PPCGenAsmWriter.inc
  38. +1 −1 capstone/arch/PowerPC/PPCGenDisassemblerTables.inc
  39. +46 −46 capstone/arch/PowerPC/PPCGenRegisterInfo.inc
  40. +4 −4 capstone/arch/PowerPC/PPCInstPrinter.c
  41. +8 −8 capstone/arch/PowerPC/PPCMapping.c
  42. +3 −7 capstone/arch/PowerPC/PPCModule.c
  43. +1 −1 capstone/arch/Sparc/Sparc.h
  44. +4 −4 capstone/arch/Sparc/SparcGenAsmWriter.inc
  45. +5 −5 capstone/arch/Sparc/SparcGenDisassemblerTables.inc
  46. +20 −20 capstone/arch/Sparc/SparcGenRegisterInfo.inc
  47. +2 −2 capstone/arch/Sparc/SparcInstPrinter.c
  48. +10 −10 capstone/arch/Sparc/SparcMapping.c
  49. +3 −6 capstone/arch/Sparc/SparcModule.c
  50. +1 −1 capstone/arch/SystemZ/SystemZDisassembler.c
  51. +1 −1 capstone/arch/SystemZ/SystemZGenAsmWriter.inc
  52. +7 −7 capstone/arch/SystemZ/SystemZGenDisassemblerTables.inc
  53. +28 −28 capstone/arch/SystemZ/SystemZGenRegisterInfo.inc
  54. +1 −1 capstone/arch/SystemZ/SystemZInstPrinter.c
  55. +6 −6 capstone/arch/SystemZ/SystemZMapping.c
  56. +4 −1 capstone/arch/SystemZ/SystemZModule.c
  57. +18 −84 capstone/arch/X86/X86ATTInstPrinter.c
  58. +1 −1 capstone/arch/X86/X86Disassembler.c
  59. +14 −1 capstone/arch/X86/X86DisassemblerDecoder.c
  60. +3 −3 capstone/arch/X86/X86GenAsmWriter.inc
  61. +3 −3 capstone/arch/X86/X86GenAsmWriter1.inc
  62. +3 −3 capstone/arch/X86/X86GenAsmWriter1_reduce.inc
  63. +3 −3 capstone/arch/X86/X86GenAsmWriter_reduce.inc
  64. +162 −162 capstone/arch/X86/X86GenRegisterInfo.inc
  65. +56 −102 capstone/arch/X86/X86IntelInstPrinter.c
  66. +46 −14 capstone/arch/X86/X86Mapping.c
  67. +5 −3 capstone/arch/X86/X86Mapping.h
  68. +2 −5 capstone/arch/X86/X86Module.c
  69. +56 −56 capstone/arch/XCore/XCoreDisassembler.c
  70. +3 −3 capstone/arch/XCore/XCoreGenAsmWriter.inc
  71. +6 −6 capstone/arch/XCore/XCoreGenDisassemblerTables.inc
  72. +8 −8 capstone/arch/XCore/XCoreGenRegisterInfo.inc
  73. +1 −1 capstone/arch/XCore/XCoreInstPrinter.c
  74. +6 −6 capstone/arch/XCore/XCoreMapping.c
  75. +4 −1 capstone/arch/XCore/XCoreModule.c
  76. +1 −1 capstone/bindings/README
  77. +8 −3 capstone/capstone.pc.in
  78. +13 −1 capstone/cs.c
  79. +9 −3 capstone/cs_priv.h
  80. +2 −2 capstone/cstool/Makefile
  81. +2 −0 capstone/cstool/cstool.c
  82. +1 −1 capstone/include/capstone.h
  83. +0 −1 capstone/include/platform.h
  84. +2 −1 capstone/make.sh
  85. +1 −1 capstone/pkgconfig.mk
  86. +1 −1 capstone/tests/README
  87. +4 −4 capstone/utils.c
  88. +4 −4 capstone/utils.h
  89. +55 −4 capstone/xcode/Capstone.xcodeproj/project.pbxproj
  90. +10 −5 capstone/xcode/Capstone.xcodeproj/xcshareddata/xcschemes/Dynamic Library.xcscheme
  91. +10 −5 capstone/xcode/Capstone.xcodeproj/xcshareddata/xcschemes/Framework.xcscheme
  92. +10 −5 capstone/xcode/Capstone.xcodeproj/xcshareddata/xcschemes/Static Library.xcscheme
  93. +3 −1 capstone/xcode/Capstone.xcodeproj/xcshareddata/xcschemes/Tests.xcscheme
  94. +4 −0 capstone/xcode/CapstoneFramework/module.modulemap
View
@@ -0,0 +1,5 @@
capstone/* linguist-vendored
FastCompression/* linguist-vendored
hde/* linguist-vendored
sha256/* linguist-vendored
umm_malloc/* linguist-vendored
View
@@ -1,16 +1,26 @@
language: cpp
sudo: false
before_install:
- export LD_LIBRARY_PATH=`pwd`/tests/:$LD_LIBRARY_PATH
env:
global:
- LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/tests/:$TRAVIS_BUILD_DIR:$LD_LIBRARY_PATH
- DYLD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/tests/:$TRAVIS_BUILD_DIR:$DYLD_LIBRARY_PATH
script:
- ./make.sh
- make check
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cp libcapstone.so bindings/python/; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then cp libcapstone.dylib bindings/python/; fi
- cd bindings/python && make check
- ./make.sh
- make check
- cd bindings/python && make check
compiler:
- clang
- gcc
- clang
- gcc
os:
- linux
- osx
- linux
- osx
matrix:
include:
- if: branch = master
os: osx
script: brew update && brew install --HEAD capstone && brew test capstone
compiler: gcc
- if: branch = master
os: osx
script: brew update && brew install --HEAD capstone && brew test capstone
compiler: clang
View
@@ -5,14 +5,14 @@
/// isPredicate - Set if this is one of the operands that made up of
/// the predicate operand that controls an isPredicable() instruction.
bool MCOperandInfo_isPredicate(MCOperandInfo *m)
bool MCOperandInfo_isPredicate(const MCOperandInfo *m)
{
return m->Flags & (1 << MCOI_Predicate);
}
/// isOptionalDef - Set if this operand is a optional def.
///
bool MCOperandInfo_isOptionalDef(MCOperandInfo *m)
bool MCOperandInfo_isOptionalDef(const MCOperandInfo *m)
{
return m->Flags & (1 << MCOI_OptionalDef);
}
View
@@ -130,16 +130,16 @@ typedef struct MCInstrDesc {
uint64_t TSFlags; // Target Specific Flag values
char ImplicitUses; // Registers implicitly read by this instr
char ImplicitDefs; // Registers implicitly defined by this instr
MCOperandInfo *OpInfo; // 'NumOperands' entries about operands
const MCOperandInfo *OpInfo; // 'NumOperands' entries about operands
uint64_t DeprecatedFeatureMask;// Feature bits that this is deprecated on, if any
// A complex method to determine is a certain is deprecated or not, and return
// the reason for deprecation.
//bool (*ComplexDeprecationInfo)(MCInst &, MCSubtargetInfo &, std::string &);
unsigned char ComplexDeprecationInfo; // dummy field, just to satisfy initializer
} MCInstrDesc;
bool MCOperandInfo_isPredicate(MCOperandInfo *m);
bool MCOperandInfo_isPredicate(const MCOperandInfo *m);
bool MCOperandInfo_isOptionalDef(MCOperandInfo *m);
bool MCOperandInfo_isOptionalDef(const MCOperandInfo *m);
#endif
View
@@ -22,18 +22,18 @@
/// defined below.
typedef struct DiffListIterator {
uint16_t Val;
MCPhysReg *List;
const MCPhysReg *List;
} DiffListIterator;
void MCRegisterInfo_InitMCRegisterInfo(MCRegisterInfo *RI,
MCRegisterDesc *D, unsigned NR,
const MCRegisterDesc *D, unsigned NR,
unsigned RA, unsigned PC,
MCRegisterClass *C, unsigned NC,
const MCRegisterClass *C, unsigned NC,
uint16_t (*RURoots)[2], unsigned NRU,
MCPhysReg *DL,
char *Strings,
uint16_t *SubIndices, unsigned NumIndices,
uint16_t *RET)
const MCPhysReg *DL,
const char *Strings,
const uint16_t *SubIndices, unsigned NumIndices,
const uint16_t *RET)
{
RI->Desc = D;
RI->NumRegs = NR;
@@ -50,7 +50,7 @@ void MCRegisterInfo_InitMCRegisterInfo(MCRegisterInfo *RI,
RI->RegEncodingTable = RET;
}
static void DiffListIterator_init(DiffListIterator *d, MCPhysReg InitVal, MCPhysReg *DiffList)
static void DiffListIterator_init(DiffListIterator *d, MCPhysReg InitVal, const MCPhysReg *DiffList)
{
d->Val = InitVal;
d->List = DiffList;
@@ -83,7 +83,7 @@ static bool DiffListIterator_isValid(DiffListIterator *d)
return (d->List != 0);
}
unsigned MCRegisterInfo_getMatchingSuperReg(MCRegisterInfo *RI, unsigned Reg, unsigned SubIdx, MCRegisterClass *RC)
unsigned MCRegisterInfo_getMatchingSuperReg(const MCRegisterInfo *RI, unsigned Reg, unsigned SubIdx, const MCRegisterClass *RC)
{
DiffListIterator iter;
@@ -105,10 +105,10 @@ unsigned MCRegisterInfo_getMatchingSuperReg(MCRegisterInfo *RI, unsigned Reg, un
return 0;
}
unsigned MCRegisterInfo_getSubReg(MCRegisterInfo *RI, unsigned Reg, unsigned Idx)
unsigned MCRegisterInfo_getSubReg(const MCRegisterInfo *RI, unsigned Reg, unsigned Idx)
{
DiffListIterator iter;
uint16_t *SRI = RI->SubRegIndices + RI->Desc[Reg].SubRegIndices;
const uint16_t *SRI = RI->SubRegIndices + RI->Desc[Reg].SubRegIndices;
DiffListIterator_init(&iter, (MCPhysReg)Reg, RI->DiffLists + RI->Desc[Reg].SubRegs);
DiffListIterator_next(&iter);
@@ -123,15 +123,15 @@ unsigned MCRegisterInfo_getSubReg(MCRegisterInfo *RI, unsigned Reg, unsigned Idx
return 0;
}
MCRegisterClass* MCRegisterInfo_getRegClass(MCRegisterInfo *RI, unsigned i)
const MCRegisterClass* MCRegisterInfo_getRegClass(const MCRegisterInfo *RI, unsigned i)
{
//assert(i < getNumRegClasses() && "Register Class ID out of range");
if (i >= RI->NumClasses)
return 0;
return &(RI->Classes[i]);
}
bool MCRegisterClass_contains(MCRegisterClass *c, unsigned Reg)
bool MCRegisterClass_contains(const MCRegisterClass *c, unsigned Reg)
{
unsigned InByte = Reg % 8;
unsigned Byte = Reg / 8;
View
@@ -27,12 +27,12 @@
/// An unsigned integer type large enough to represent all physical registers,
/// but not necessarily virtual registers.
typedef uint16_t MCPhysReg;
typedef MCPhysReg* iterator;
typedef const MCPhysReg* iterator;
typedef struct MCRegisterClass {
char *Name;
const char *Name;
iterator RegsBegin;
uint8_t *RegSet;
const uint8_t *RegSet;
uint16_t RegsSize;
uint16_t RegSetSize;
uint16_t ID;
@@ -75,42 +75,42 @@ typedef struct MCRegisterDesc {
/// virtual methods.
///
typedef struct MCRegisterInfo {
MCRegisterDesc *Desc; // Pointer to the descriptor array
const MCRegisterDesc *Desc; // Pointer to the descriptor array
unsigned NumRegs; // Number of entries in the array
unsigned RAReg; // Return address register
unsigned PCReg; // Program counter register
MCRegisterClass *Classes; // Pointer to the regclass array
const MCRegisterClass *Classes; // Pointer to the regclass array
unsigned NumClasses; // Number of entries in the array
unsigned NumRegUnits; // Number of regunits.
uint16_t (*RegUnitRoots)[2]; // Pointer to regunit root table.
MCPhysReg *DiffLists; // Pointer to the difflists array
char *RegStrings; // Pointer to the string table.
uint16_t *SubRegIndices; // Pointer to the subreg lookup
const MCPhysReg *DiffLists; // Pointer to the difflists array
const char *RegStrings; // Pointer to the string table.
const uint16_t *SubRegIndices; // Pointer to the subreg lookup
// array.
unsigned NumSubRegIndices; // Number of subreg indices.
uint16_t *RegEncodingTable; // Pointer to array of register
const uint16_t *RegEncodingTable; // Pointer to array of register
// encodings.
} MCRegisterInfo;
void MCRegisterInfo_InitMCRegisterInfo(MCRegisterInfo *RI,
MCRegisterDesc *D, unsigned NR, unsigned RA,
const MCRegisterDesc *D, unsigned NR, unsigned RA,
unsigned PC,
MCRegisterClass *C, unsigned NC,
const MCRegisterClass *C, unsigned NC,
uint16_t (*RURoots)[2],
unsigned NRU,
MCPhysReg *DL,
char *Strings,
uint16_t *SubIndices,
const MCPhysReg *DL,
const char *Strings,
const uint16_t *SubIndices,
unsigned NumIndices,
uint16_t *RET);
const uint16_t *RET);
unsigned MCRegisterInfo_getMatchingSuperReg(MCRegisterInfo *RI, unsigned Reg, unsigned SubIdx, MCRegisterClass *RC);
unsigned MCRegisterInfo_getMatchingSuperReg(const MCRegisterInfo *RI, unsigned Reg, unsigned SubIdx, const MCRegisterClass *RC);
unsigned MCRegisterInfo_getSubReg(MCRegisterInfo *RI, unsigned Reg, unsigned Idx);
unsigned MCRegisterInfo_getSubReg(const MCRegisterInfo *RI, unsigned Reg, unsigned Idx);
MCRegisterClass* MCRegisterInfo_getRegClass(MCRegisterInfo *RI, unsigned i);
const MCRegisterClass* MCRegisterInfo_getRegClass(const MCRegisterInfo *RI, unsigned i);
bool MCRegisterClass_contains(MCRegisterClass *c, unsigned Reg);
bool MCRegisterClass_contains(const MCRegisterClass *c, unsigned Reg);
#endif
View
@@ -37,7 +37,7 @@ ifneq (,$(findstring yes,$(CAPSTONE_X86_ATT_DISABLE)))
CFLAGS += -DCAPSTONE_X86_ATT_DISABLE
endif
CFLAGS += -fPIC -Wall -Iinclude
CFLAGS += -fPIC -Wall -Wwrite-strings -Iinclude
ifeq ($(CAPSTONE_USE_SYS_DYN_MEM),yes)
CFLAGS += -DCAPSTONE_USE_SYS_DYN_MEM
@@ -53,9 +53,6 @@ CFLAGS += -mmacosx-version-min=10.5 \
-fno-builtin
endif
CFLAGS += $(foreach arch,$(LIBARCHS),-arch $(arch))
LDFLAGS += $(foreach arch,$(LIBARCHS),-arch $(arch))
PREFIX ?= /usr
DESTDIR ?=
ifndef BUILDDIR
@@ -259,6 +256,12 @@ VERSION_EXT =
IS_APPLE := $(shell $(CC) -dM -E - < /dev/null | grep -cm 1 -e __apple_build_version__ -e __APPLE_CC__)
ifeq ($(IS_APPLE),1)
# on MacOS, compile in Universal format by default
MACOS_UNIVERSAL ?= yes
ifeq ($(MACOS_UNIVERSAL),yes)
CFLAGS += $(foreach arch,$(LIBARCHS),-arch $(arch))
LDFLAGS += $(foreach arch,$(LIBARCHS),-arch $(arch))
endif
EXT = dylib
VERSION_EXT = $(API_MAJOR).$(EXT)
$(LIBNAME)_LDFLAGS += -dynamiclib -install_name lib$(LIBNAME).$(VERSION_EXT) -current_version $(PKG_MAJOR).$(PKG_MINOR).$(PKG_EXTRA) -compatibility_version $(PKG_MAJOR).$(PKG_MINOR)
@@ -272,6 +275,8 @@ CFLAGS += -D_FORTIFY_SOURCE=0
endif
endif
else
CFLAGS += $(foreach arch,$(LIBARCHS),-arch $(arch))
LDFLAGS += $(foreach arch,$(LIBARCHS),-arch $(arch))
$(LIBNAME)_LDFLAGS += -shared
# Cygwin?
IS_CYGWIN := $(shell $(CC) -dumpmachine | grep -i cygwin | wc -l)
View
@@ -28,7 +28,7 @@ void SStream_Init(SStream *ss)
ss->buffer[0] = '\0';
}
void SStream_concat0(SStream *ss, char *s)
void SStream_concat0(SStream *ss, const char *s)
{
#ifndef CAPSTONE_DIET
unsigned int len = (unsigned int) strlen(s);
View
@@ -13,7 +13,7 @@ void SStream_Init(SStream *ss);
void SStream_concat(SStream *ss, const char *fmt, ...);
void SStream_concat0(SStream *ss, char *s);
void SStream_concat0(SStream *ss, const char *s);
void printInt64Bang(SStream *O, int64_t val);
Oops, something went wrong.

0 comments on commit 952132d

Please sign in to comment.