Skip to content

Commit

Permalink
Merge branch 'next' of github.com:aquynh/capstone into next
Browse files Browse the repository at this point in the history
  • Loading branch information
aeflores committed Sep 17, 2020
2 parents 32ce547 + c66bb33 commit d96d3bd
Show file tree
Hide file tree
Showing 25 changed files with 203 additions and 83 deletions.
36 changes: 31 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -658,25 +658,51 @@ include("GNUInstallDirs")
install(FILES ${HEADERS_COMMON} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/capstone)
configure_file(capstone.pc.in ${CMAKE_BINARY_DIR}/capstone.pc @ONLY)

include(CMakePackageConfigHelpers)
set(CAPSTONE_CMAKE_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/capstone")
configure_package_config_file(
capstone-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/capstone-config.cmake
INSTALL_DESTINATION ${CAPSTONE_CMAKE_CONFIG_INSTALL_DIR}
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/capstone-config-version.cmake
VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
COMPATIBILITY SameMajorVersion
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/capstone-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/capstone-config-version.cmake"
DESTINATION ${CAPSTONE_CMAKE_CONFIG_INSTALL_DIR}
)

if (CAPSTONE_BUILD_STATIC)
install(TARGETS capstone-static
RUNTIME DESTINATION bin
EXPORT capstone-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif ()

if (CAPSTONE_BUILD_SHARED)
install(TARGETS capstone-shared
RUNTIME DESTINATION bin
EXPORT capstone-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif ()

install(EXPORT capstone-targets
NAMESPACE capstone::
DESTINATION ${CAPSTONE_CMAKE_CONFIG_INSTALL_DIR})

if (CAPSTONE_BUILD_SHARED AND CAPSTONE_BUILD_CSTOOL)
FILE(GLOB CSTOOL_SRC cstool/*.c)
add_executable(cstool ${CSTOOL_SRC})
target_link_libraries(cstool ${default-target})

install(TARGETS cstool DESTINATION bin)
install(TARGETS cstool DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES ${CMAKE_BINARY_DIR}/capstone.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
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 8.1 Update 1 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).
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 @@ -480,24 +480,28 @@ 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)
rm -f $(AUTODEPS)
[ "${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
54 changes: 54 additions & 0 deletions arch/AArch64/AArch64InstPrinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,60 @@ void AArch64_printInst(MCInst *MI, SStream *O, void *Info)

switch(MCInst_getOpcode(MI)) {
default: break;
case AArch64_LD1i8_POST:
arm64_op_addImm(MI, 1);
break;
case AArch64_LD1i16_POST:
arm64_op_addImm(MI, 2);
break;
case AArch64_LD1i32_POST:
arm64_op_addImm(MI, 4);
break;
case AArch64_LD1Onev1d_POST:
case AArch64_LD1Onev2s_POST:
case AArch64_LD1Onev4h_POST:
case AArch64_LD1Onev8b_POST:
case AArch64_LD1i64_POST:
arm64_op_addImm(MI, 8);
break;
case AArch64_LD1Onev16b_POST:
case AArch64_LD1Onev2d_POST:
case AArch64_LD1Onev4s_POST:
case AArch64_LD1Onev8h_POST:
case AArch64_LD1Twov1d_POST:
case AArch64_LD1Twov2s_POST:
case AArch64_LD1Twov4h_POST:
case AArch64_LD1Twov8b_POST:
arm64_op_addImm(MI, 16);
break;
case AArch64_LD1Threev1d_POST:
case AArch64_LD1Threev2s_POST:
case AArch64_LD1Threev4h_POST:
case AArch64_LD1Threev8b_POST:
arm64_op_addImm(MI, 24);
break;
case AArch64_LD1Fourv1d_POST:
case AArch64_LD1Fourv2s_POST:
case AArch64_LD1Fourv4h_POST:
case AArch64_LD1Fourv8b_POST:
case AArch64_LD1Twov16b_POST:
case AArch64_LD1Twov2d_POST:
case AArch64_LD1Twov4s_POST:
case AArch64_LD1Twov8h_POST:
arm64_op_addImm(MI, 32);
break;
case AArch64_LD1Threev16b_POST:
case AArch64_LD1Threev2d_POST:
case AArch64_LD1Threev4s_POST:
case AArch64_LD1Threev8h_POST:
arm64_op_addImm(MI, 48);
break;
case AArch64_LD1Fourv16b_POST:
case AArch64_LD1Fourv2d_POST:
case AArch64_LD1Fourv4s_POST:
case AArch64_LD1Fourv8h_POST:
arm64_op_addImm(MI, 64);
break;
case AArch64_UMOVvi64:
arm64_op_addVectorArrSpecifier(MI, ARM64_VAS_1D);
break;
Expand Down
1 change: 1 addition & 0 deletions arch/AArch64/AArch64Mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ static const name_map group_name_maps[] = {
{ ARM64_GRP_PRIVILEGE, "privilege" },
{ ARM64_GRP_INT, "int" },
{ ARM64_GRP_BRANCH_RELATIVE, "branch_relative" },
{ ARM64_GRP_PAC, "pointer authentication" },

// architecture-specific groups
{ ARM64_GRP_CRYPTO, "crypto" },
Expand Down
Loading

0 comments on commit d96d3bd

Please sign in to comment.