Skip to content
Open

V4 #25

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
98130bb
Fixed anon type in anon union error in m68k.h (#1597)
netromdk Mar 19, 2020
94a6eb8
Add Common Lisp bindings (#1605)
eschulte Mar 23, 2020
df0d2b0
Add vcpkg installation instructions (#1602)
NancyLi1013 Mar 24, 2020
77bd07a
Fix Makefile CAPSTONE_BUILD_CORE_ONLY (#1617)
Summus-31c04089c3cd80 May 4, 2020
f650595
Add __repr__ for capstone.CsInsn (#1625)
disconnect3d May 4, 2020
4b7c130
update .gitignore
aquynh May 7, 2020
f1590aa
ChangeLog and ReleaseNotes for 4.0.2
aquynh May 7, 2020
1d23053
update SPONSORS.TXT for v4.0.2
aquynh May 8, 2020
b1a46a4
Allow to override PYTHON[23] in Makefiles (#1639)
sh1r4s3 May 30, 2020
2edae85
Fixed incorrect read of 32-bit imm for bsr (#1644)
emoon Jun 12, 2020
aeff08f
capstone.pc.in: use CMAKE_INSTALL_LIBDIR for libdir (#1659)
Jul 19, 2020
659c01a
fix CS_ mips_ OP structure comment error (#1674)
junchao-loongson Aug 6, 2020
32f17c2
systemz: pad instruction width up to 6 bytes (#1679)
carenas Sep 3, 2020
918e9c4
include: avoid UB with signed overflow/shift (#1675)
carenas Sep 15, 2020
7ca653c
MCInst: fix uninitialized value in operand value (#1685)
StalkR Sep 16, 2020
b9889b4
Option to generate install target (#1698)
Oct 27, 2020
b183f15
fix conflicts
chfl4gs Nov 15, 2020
20005df
python: only use ascii character (#1704)
catenacyber Nov 17, 2020
f886bb1
Honour direction bit in fmove instruction (#1709)
michalsc Dec 3, 2020
aa74f5d
code style fix
aquynh Dec 3, 2020
8635f65
Fix -Wstringop-truncation warnings (#1730)
kazarmy May 11, 2021
a7cac83
Fix register accesses on x86 'test' instruction (#1751)
Quentin01 May 17, 2021
0351008
M680X - remove unused s_cpu_type (#1695)
XVilka Oct 29, 2020
0efa3cc
Merge pull request #1801 from kazarmy/clang-Wunneeded-decl-fix
kabeor Dec 2, 2021
975a4f1
Add meta-programming macros for ARM64/AArch64 name change to capstone…
Rot127 Nov 19, 2023
dec87d6
Add tests for rename macros. (#2202)
Rot127 Nov 20, 2023
d7e459d
Add CS_aarch64 macro without parameter. (#2220)
Rot127 Dec 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: PyPI 📦 Distribution

on: [push]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
platform: [x32, x64]
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Set up MSVC x86
if: matrix.os == 'windows-latest' && matrix.platform == 'x32'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86

- name: Set up MSVC x64
if: matrix.os == 'windows-latest' && matrix.platform == 'x64'
uses: ilammy/msvc-dev-cmd@v1

- name: Install dependencies
run: |
pip install setuptools wheel

- name: Build distribution 📦
shell: bash
run: |
if [ ${{ matrix.platform }} == 'x32' ] && [ ${{ matrix.os }} == 'windows-latest' ]; then
cd bindings/python && python setup.py build -p win32 bdist_wheel -p win32
elif [ ${{ matrix.platform }} == 'x32' ] && [ ${{ matrix.os }} == 'ubuntu-latest' ]; then
docker run --rm -v `pwd`/:/work dockcross/manylinux1-x86 > ./dockcross
chmod +x ./dockcross
./dockcross bindings/python/build_wheel.sh
elif [ ${{ matrix.platform }} == 'x64' ] && [ ${{ matrix.os }} == 'ubuntu-latest' ]; then
docker run --rm -v `pwd`/:/work dockcross/manylinux1-x64 > ./dockcross
chmod +x ./dockcross
./dockcross bindings/python/build_wheel.sh
elif [ ${{ matrix.platform }} == 'x32' ] && [ ${{ matrix.os }} == 'macos-latest' ]; then
cd bindings/python && python setup.py sdist
else
cd bindings/python && python setup.py bdist_wheel
fi

- uses: actions/upload-artifact@v2
with:
path: ${{ github.workspace }}/bindings/python/dist/*

publish:
needs: [build]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist

- name: Publish distribution 📦 to test PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.testpypi_pass }}
repository_url: https://test.pypi.org/legacy/

- name: Publish distribution 📦 to PyPI
if: ${{ success() }}
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_pass }}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ fuzz_bindisasm
fuzz_disasm
capstone_get_setup

suite/fuzz/fuzz_bindisasm2
suite/fuzz/fuzz_decode_platform
tests/test_bpf
tests/test_mos65xx
tests/test_riscv
tests/test_wasm


*.s

Expand Down
15 changes: 10 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ option(CAPSTONE_BUILD_TESTS "Build tests" ON)
option(CAPSTONE_BUILD_CSTOOL "Build cstool" ON)
option(CAPSTONE_USE_DEFAULT_ALLOC "Use default memory allocation functions" ON)
option(CAPSTONE_ARCHITECTURE_DEFAULT "Whether architectures are enabled by default" ON)
option(CAPSTONE_INSTALL "Generate install target" ON)

set(SUPPORTED_ARCHITECTURES ARM ARM64 M68K MIPS PPC SPARC SYSZ XCORE X86 TMS320C64X M680X EVM)
set(SUPPORTED_ARCHITECTURE_LABELS ARM ARM64 M68K MIPS PowerPC Sparc SystemZ XCore x86 TMS320C64x M680x EVM)
Expand Down Expand Up @@ -563,17 +564,19 @@ source_group("Include\\EVM" FILES ${HEADERS_EVM})
include("GNUInstallDirs")

## installation
install(FILES ${HEADERS_COMMON} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/capstone)
if (CAPSTONE_INSTALL)
install(FILES ${HEADERS_COMMON} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/capstone)
endif ()
configure_file(capstone.pc.in ${CMAKE_BINARY_DIR}/capstone.pc @ONLY)

if (CAPSTONE_BUILD_STATIC)
if (CAPSTONE_BUILD_STATIC AND CAPSTONE_INSTALL)
install(TARGETS capstone-static
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif ()

if (CAPSTONE_BUILD_SHARED)
if (CAPSTONE_BUILD_SHARED AND CAPSTONE_INSTALL)
install(TARGETS capstone-shared
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
Expand All @@ -585,6 +588,8 @@ FILE(GLOB CSTOOL_SRC cstool/*.c)
add_executable(cstool ${CSTOOL_SRC})
target_link_libraries(cstool ${default-target})

install(TARGETS cstool DESTINATION bin)
install(FILES ${CMAKE_BINARY_DIR}/capstone.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
if (CAPSTONE_INSTALL)
install(TARGETS cstool DESTINATION bin)
install(FILES ${CMAKE_BINARY_DIR}/capstone.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif ()
endif ()
14 changes: 14 additions & 0 deletions COMPILE_MSVC.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,17 @@ versions, and Windows Driver Kit 10 or newer versions are required.

>sc delete test_winkernel
>bcdedit /deletevalue testsigning



(3) Installing and building capstone via vcpkg

You can download and install capstone using the vcpkg(https://github.com/Microsoft/vcpkg) dependency manager:

git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
vcpkg install capstone

The capstone port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository(https://github.com/Microsoft/vcpkg).
3 changes: 3 additions & 0 deletions CREDITS.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,6 @@ Fotis Loukos: TMS320C64x architecture.
Wolfgang Schwotzer: M680X architecture.
Philippe Antoine: Integration with oss-fuzz and various fixes.
Stephen Eckels (stevemk14ebr): x86 encoding features
Sebastian Macke: MOS65XX architecture
Do Minh Tuan: Regression testing tool (cstest)
Kevin Foo (chfl4gs): PyPI github actions workflow.
71 changes: 71 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,76 @@
This file details the changelog of Capstone.

----------------------------
Version 4.0.2: May 8th, 2020


[ Core ]

- Windows kernel-mode driver support
- Fix installation path on FreeBSD and DragonFly


[ cstool ]

- Add armv8, ppc32 & thumbv8 modes
- Print instruction ID


[ X86 ]

- Support CS_OPT_UNSIGNED for ATT syntax
- Fix operand size for some instructions
- Fix LOCK prefixes
- Recognize xacquire/xrelease prefix
- Fix call/jmp access mode of mem operand
- Add ENDBR32, ENDBR64 to reduce mode
- Other minor fixes


[ ARM64 ]

- Support CS_OPT_UNSIGNED
- Fix register access flags for memory instructions
- Fix UMOV vess


[ ARM ]

- Update writeback for STR_POST_REG


[ M68K ]

- Store correct register value in op.reg_pair


[ PowerPC ]

- BDZLA is absolute branch


[ SystemZ ]

- Fix truncated 64bit imm operand
- Fix base/index printing


[ Python ]

- Fix skipdata struct being destroyed
- Add __repr__ for capstone.CsInsn


[ Java ]

- Fix Java bindings to use pointers instead of longs


[ Ocaml ]

- Fix x86_op record


---------------------------------
Version 4.0.1: January 10th, 2019

Expand Down
1 change: 1 addition & 0 deletions MCInst.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ void MCInst_Init(MCInst *inst)

for (i = 0; i < 48; i++) {
inst->Operands[i].Kind = kInvalid;
inst->Operands[i].ImmVal = 0;
}

inst->Opcode = 0;
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -417,23 +417,27 @@ endif
$(INSTALL_DATA) include/capstone/*.h $(DESTDIR)$(INCDIR)/$(LIBNAME)
mkdir -p $(PKGCFGDIR)
$(INSTALL_DATA) $(PKGCFGF) $(PKGCFGDIR)
ifeq (,$(findstring yes,$(CAPSTONE_BUILD_CORE_ONLY)))
mkdir -p $(BINDIR)
$(INSTALL_LIB) cstool/cstool $(BINDIR)
endif

uninstall:
rm -rf $(DESTDIR)$(INCDIR)/$(LIBNAME)
rm -f $(LIBDIR)/lib$(LIBNAME).*
rm -f $(PKGCFGDIR)/$(LIBNAME).pc
ifeq (,$(findstring yes,$(CAPSTONE_BUILD_CORE_ONLY)))
rm -f $(BINDIR)/cstool
endif

clean:
rm -f $(LIBOBJ)
rm -f $(BLDIR)/lib$(LIBNAME).* $(BLDIR)/$(LIBNAME).pc
rm -f $(PKGCFGF)
[ "${ANDROID}" = "1" ] && rm -rf android-ndk-* || true
$(MAKE) -C cstool clean

ifeq (,$(findstring yes,$(CAPSTONE_BUILD_CORE_ONLY)))
$(MAKE) -C cstool clean
$(MAKE) -C tests clean
$(MAKE) -C suite/fuzz clean
rm -f $(BLDIR)/tests/lib$(LIBNAME).$(EXT)
Expand Down
4 changes: 4 additions & 0 deletions RELEASE_NOTES
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This release 4.0.2 is dedicated to my dad!

Without him, I would not work in computing field, let alone writing any code
or making contribution to the cyber security community.
8 changes: 8 additions & 0 deletions SPONSORS.TXT
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
* Version 4.0.2 - May 08th, 2020

Release 4.0.2 was sponsored by the following companies (in no particular order).

- Senrio: https://senr.io
- Catena Cyber: https://catenacyber.fr

------------------------------------
* Version 4.0.1 - January 10th, 2019

Release 4.0.1 was sponsored by the following companies (in no particular order).
Expand Down
11 changes: 0 additions & 11 deletions arch/M680X/M680XDisassembler.c
Original file line number Diff line number Diff line change
Expand Up @@ -2121,11 +2121,6 @@ static const cpu_tables g_cpu_tables[] = {
},
};

static const char *s_cpu_type[] = {
"INVALID", "6301", "6309", "6800", "6801", "6805", "6808",
"6809", "6811", "CPU12", "HCS08",
};

static bool m680x_setup_internals(m680x_info *info, e_cpu_type cpu_type,
uint16_t address,
const uint8_t *code, uint16_t code_len)
Expand Down Expand Up @@ -2255,12 +2250,6 @@ cs_err M680X_disassembler_init(cs_struct *ud)
return CS_ERR_MODE;
}

if (M680X_CPU_TYPE_ENDING != ARR_SIZE(s_cpu_type)) {
CS_ASSERT(M680X_CPU_TYPE_ENDING == ARR_SIZE(s_cpu_type));

return CS_ERR_MODE;
}

if (M680X_CPU_TYPE_ENDING != ARR_SIZE(g_cpu_tables)) {
CS_ASSERT(M680X_CPU_TYPE_ENDING == ARR_SIZE(g_cpu_tables));

Expand Down
12 changes: 9 additions & 3 deletions arch/M68K/M68KDisassembler.c
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,7 @@ static void d68000_bsr_16(m68k_info *info)
static void d68020_bsr_32(m68k_info *info)
{
LIMIT_CPU_TYPES(info, M68020_PLUS);
build_relative_branch(info, M68K_INS_BSR, 4, peek_imm_32(info));
build_relative_branch(info, M68K_INS_BSR, 4, read_imm_32(info));
}

static void d68000_btst_r(m68k_info *info)
Expand Down Expand Up @@ -2036,8 +2036,14 @@ static void d68020_cpgen(m68k_info *info)
ext->op_size.type = M68K_SIZE_TYPE_CPU;
ext->op_size.cpu_size = 0;

op0 = &ext->operands[0];
op1 = &ext->operands[1];
// Special case - adjust direction of fmove
if ((opmode == 0x00) && ((next >> 13) & 0x1) != 0) {
op0 = &ext->operands[1];
op1 = &ext->operands[0];
} else {
op0 = &ext->operands[0];
op1 = &ext->operands[1];
}

if (rm == 0 && supports_single_op && src == dst) {
ext->op_count = 1;
Expand Down
2 changes: 1 addition & 1 deletion arch/Sparc/SparcInstPrinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ void Sparc_printInst(MCInst *MI, SStream *O, void *Info)
mnem = printAliasInstr(MI, O, Info);
if (mnem) {
// fixup instruction id due to the change in alias instruction
strncpy(instr, mnem, sizeof(instr));
strncpy(instr, mnem, sizeof(instr) - 1);
instr[sizeof(instr) - 1] = '\0';
// does this contains hint with a coma?
p = strchr(instr, ',');
Expand Down
Loading
Loading