forked from capstone-engine/capstone
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
130 changed files
with
1,225,629 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
How To Compile & Run Capstone for Linux, Mac OSX, *nix and Windows | ||
*-*-*-*-*-* | ||
|
||
|
||
Capstone requires no prerequisite packages, so it is easy to compile & install. | ||
|
||
|
||
(1) On Linux, Mac OSX or *nix: | ||
|
||
- To compile for current platform, run either: | ||
$ ./compile.sh | ||
or: | ||
$ make | ||
|
||
Then run "./tests/test*" to see the tests disassembling sample code. | ||
|
||
- On 64-bit OS, if you want to cross-compile Capstone for 32-bit binary, run: | ||
|
||
$ ./compile.sh nix32 | ||
|
||
Then similarly, run "./tests/test*" to see the tests disassembling sample code. | ||
|
||
|
||
|
||
(2) To install Capstone, run: | ||
|
||
$ sudo make install | ||
|
||
You are then required to enter root password to copy Capstone into machine | ||
system directories. | ||
|
||
NOTE: The core framework that will be installed by "make install" consist of | ||
only following files: | ||
|
||
/usr/include/include/capstone.h | ||
/usr/include/include/x86.h | ||
/usr/include/include/arm.h | ||
/usr/include/include/arm64.h | ||
/usr/include/include/mips.h | ||
/usr/lib/libcapstone.so (for Linux/*nix), or /usr/lib/libcapstone.dylib (OSX) | ||
|
||
|
||
|
||
(3) To cross-compile for Windows, Linux & gcc-mingw-w64-i686 (and also gcc-mingw-w64-x86-64 | ||
if you want 64-bit binaries) are required. | ||
|
||
- To cross-compile Windows 32-bit binary, simply run | ||
$ ./compile.sh win32 | ||
|
||
- To cross-compile Windows 64-bit binary, simply run | ||
$ ./compile.sh win64 | ||
|
||
Resulted files "capstone.dll" and "tests/test*.exe" can then be used on Windows machine. | ||
|
||
|
||
|
||
(4) By default, gcc is used as compiler. If you want to use "clang" instead, compile | ||
the code with: | ||
|
||
$ ./compile clang | ||
|
||
|
||
(5) So far, Python, Ruby, Ocaml, Java, C# and Go are supported by bindings. Look for the bindings | ||
under directory bindings/, and refer to README file of corresponding languages. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
This file credits all the contributors of the Capstone engine project. | ||
|
||
Key developers | ||
============== | ||
1. Nguyen Anh Quynh <aquynh -at- gmail.com> | ||
- Core engine | ||
- Bindings: Python, Ruby, OCaml, Java, C# | ||
|
||
2. Tan Sheng Di <shengdi -at- coseinc.com> | ||
- Bindings: Ruby | ||
|
||
3. Ben Nagy <ben -at- coseinc.com> | ||
- Bindings: Ruby, Go | ||
|
||
4. Dang Hoang Vu <dang.hvu -at- gmail.com> | ||
- Bindings: Java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
//===- llvm/Support/LEB128.h - [SU]LEB128 utility functions -----*- C++ -*-===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This file declares some utility functions for encoding SLEB128 and | ||
// ULEB128 values. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
/* Capstone Disassembler Engine */ | ||
/* By Nguyen Anh Quynh <[email protected]>, 2013> */ | ||
|
||
#ifndef CS_LLVM_SUPPORT_LEB128_H | ||
#define CS_LLVM_SUPPORT_LEB128_H | ||
|
||
#include <stdint.h> | ||
|
||
/// Utility function to decode a ULEB128 value. | ||
static inline uint64_t decodeULEB128(const uint8_t *p, unsigned *n) | ||
{ | ||
const uint8_t *orig_p = p; | ||
uint64_t Value = 0; | ||
unsigned Shift = 0; | ||
do { | ||
Value += (*p & 0x7f) << Shift; | ||
Shift += 7; | ||
} while (*p++ >= 128); | ||
if (n) | ||
*n = (unsigned)(p - orig_p); | ||
return Value; | ||
} | ||
|
||
#endif // LLVM_SYSTEM_LEB128_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
This is the software license for Capstone disassembly framework. | ||
Capstone has been designed & implemented by Nguyen Anh Quynh <[email protected]> | ||
|
||
Copyright (c) 2013, COSEINC. | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
* Neither the name of the developer(s) nor the names of its | ||
contributors may be used to endorse or promote products derived from this | ||
software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
============================================================================== | ||
LLVM Release License | ||
============================================================================== | ||
University of Illinois/NCSA | ||
Open Source License | ||
|
||
Copyright (c) 2003-2013 University of Illinois at Urbana-Champaign. | ||
All rights reserved. | ||
|
||
Developed by: | ||
|
||
LLVM Team | ||
|
||
University of Illinois at Urbana-Champaign | ||
|
||
http://llvm.org | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal with | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
of the Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
|
||
* Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimers. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimers in the | ||
documentation and/or other materials provided with the distribution. | ||
|
||
* Neither the names of the LLVM Team, University of Illinois at | ||
Urbana-Champaign, nor the names of its contributors may be used to | ||
endorse or promote products derived from this Software without specific | ||
prior written permission. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE | ||
SOFTWARE. | ||
|
||
============================================================================== | ||
Copyrights and Licenses for Third Party Software Distributed with LLVM: | ||
============================================================================== | ||
The LLVM software contains code written by third parties. Such software will | ||
have its own individual LICENSE.TXT file in the directory in which it appears. | ||
This file will describe the copyrights, license, and restrictions which apply | ||
to that code. | ||
|
||
The disclaimer of warranty in the University of Illinois Open Source License | ||
applies to all code in the LLVM Distribution, and nothing in any of the | ||
other licenses gives permission to use the names of the LLVM Team or the | ||
University of Illinois to endorse or promote products derived from this | ||
Software. | ||
|
||
The following pieces of software have additional or alternate copyrights, | ||
licenses, and/or restrictions: | ||
|
||
Program Directory | ||
------- --------- | ||
Autoconf llvm/autoconf | ||
llvm/projects/ModuleMaker/autoconf | ||
llvm/projects/sample/autoconf | ||
Google Test llvm/utils/unittest/googletest | ||
OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex} | ||
pyyaml tests llvm/test/YAMLParser/{*.data, LICENSE.TXT} | ||
ARM contributions llvm/lib/Target/ARM/LICENSE.TXT | ||
md5 contributions llvm/lib/Support/MD5.cpp llvm/include/llvm/Support/MD5.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* Capstone Disassembler Engine */ | ||
/* By Nguyen Anh Quynh <[email protected]>, 2013> */ | ||
|
||
#ifndef __CS_MCDISASSEMBLER_H__ | ||
#define __CS_MCDISASSEMBLER_H__ | ||
|
||
typedef enum DecodeStatus { | ||
MCDisassembler_Fail = 0, | ||
MCDisassembler_SoftFail = 1, | ||
MCDisassembler_Success = 3, | ||
} DecodeStatus; | ||
|
||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
//===-- llvm/MC/MCFixedLenDisassembler.h - Decoder driver -------*- C++ -*-===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// Fixed length disassembler decoder state machine driver. | ||
//===----------------------------------------------------------------------===// | ||
|
||
/* Capstone Disassembler Engine */ | ||
/* By Nguyen Anh Quynh <[email protected]>, 2013> */ | ||
|
||
#ifndef CS_LLVM_MC_MCFIXEDLENDISASSEMBLER_H | ||
#define CS_LLVM_MC_MCFIXEDLENDISASSEMBLER_H | ||
|
||
// Disassembler state machine opcodes. | ||
enum DecoderOps { | ||
MCD_OPC_ExtractField = 1, // OPC_ExtractField(uint8_t Start, uint8_t Len) | ||
MCD_OPC_FilterValue, // OPC_FilterValue(uleb128 Val, uint16_t NumToSkip) | ||
MCD_OPC_CheckField, // OPC_CheckField(uint8_t Start, uint8_t Len, | ||
// uleb128 Val, uint16_t NumToSkip) | ||
MCD_OPC_CheckPredicate, // OPC_CheckPredicate(uleb128 PIdx, uint16_t NumToSkip) | ||
MCD_OPC_Decode, // OPC_Decode(uleb128 Opcode, uleb128 DIdx) | ||
MCD_OPC_SoftFail, // OPC_SoftFail(uleb128 PMask, uleb128 NMask) | ||
MCD_OPC_Fail // OPC_Fail() | ||
}; | ||
|
||
#endif |
Oops, something went wrong.