[libdisasm] init

This commit is contained in:
atkawa7 2018-01-21 12:48:37 +02:00
parent c1d0597003
commit 751877f4e8
4 changed files with 112 additions and 0 deletions

View File

@ -0,0 +1,46 @@
cmake_minimum_required(VERSION 3.9)
project(libdisasm)
set(
SRCS
ia32_implicit.c
ia32_implicit.h
ia32_insn.c
ia32_insn.h
ia32_invariant.c
ia32_invariant.h
ia32_modrm.c
ia32_modrm.h
ia32_opcode_tables.c
ia32_opcode_tables.h
ia32_operand.c
ia32_operand.h
ia32_reg.c
ia32_reg.h
ia32_settings.c
ia32_settings.h
libdis.h
qword.h
x86_disasm.c
x86_format.c
x86_imm.c
x86_imm.h
x86_insn.c
x86_misc.c
x86_operand_list.c
x86_operand_list.h
)
include_directories(libdisasm)
add_library(libdisasm ${SRCS})
install(
TARGETS libdisasm
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
if(NOT DISABLE_INSTALL_HEADERS)
install(FILES libdis.h DESTINATION include)
endif()

3
ports/libdisasm/CONTROL Normal file
View File

@ -0,0 +1,3 @@
Source: libdisasm
Version: 0.23
Description: x86 Disassembler Library.

View File

@ -0,0 +1,34 @@
include(vcpkg_common_functions)
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
message(WARNING "Warning: Dynamic building not supported. Building static.")
set(VCPKG_LIBRARY_LINKAGE static)
endif()
set(BASE_PATH ${CURRENT_BUILDTREES_DIR}/src/libdisasm-0.23)
set(SOURCE_PATH ${BASE_PATH}/libdisasm)
vcpkg_download_distfile(ARCHIVE
URLS "https://sourceforge.net/projects/bastard/files/libdisasm/0.23/libdisasm-0.23.tar.gz"
FILENAME "libdisasm-0.23.tar.gz"
SHA512 29eecfbfd8168188242278a1a38f0c90770d0581a52d4600ae6343829dd0d6607b98329f12a3d7409d43dd56dca6a7d1eb25d58a001c2bfd3eb8474c0e7879e7
)
vcpkg_extract_source_archive(${ARCHIVE})
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES ${CMAKE_CURRENT_LIST_DIR}/sizeofvoid.patch
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON
)
vcpkg_install_cmake()
# Handle copyright
file(INSTALL ${BASE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libdisasm RENAME copyright)

View File

@ -0,0 +1,29 @@
diff --git a/x86_disasm.c b/x86_disasm.c
index 04574fa..177bfb8 100644
--- a/x86_disasm.c
+++ b/x86_disasm.c
@@ -35,7 +35,7 @@ unsigned int x86_disasm( unsigned char *buf, unsigned int buf_len,
if ( offset >= buf_len ) {
/* another caller screwup ;) */
- x86_report_error(report_disasm_bounds, (void*)(long)buf_rva+offset);
+ x86_report_error(report_disasm_bounds, (void*)(long)(buf_rva+offset));
return 0;
}
@@ -53,13 +53,13 @@ unsigned int x86_disasm( unsigned char *buf, unsigned int buf_len,
/* check and see if we had an invalid instruction */
if (! size ) {
- x86_report_error(report_invalid_insn, (void*)(long)buf_rva+offset );
+ x86_report_error(report_invalid_insn, (void*)(long)(buf_rva+offset));
return 0;
}
/* check if we overran the end of the buffer */
if ( size > len ) {
- x86_report_error( report_insn_bounds, (void*)(long)buf_rva + offset );
+ x86_report_error( report_insn_bounds, (void*)(long)(buf_rva + offset));
MAKE_INVALID( insn, bytes );
return 0;
}