Skip to content

Commit

Permalink
Added support for the TMS320C64x architecture.
Browse files Browse the repository at this point in the history
  • Loading branch information
fotisl committed Apr 14, 2017
1 parent d46a4f2 commit 0850d55
Show file tree
Hide file tree
Showing 27 changed files with 6,770 additions and 12 deletions.
29 changes: 27 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ option(CAPSTONE_BUILD_DIET "Build diet library" OFF)
option(CAPSTONE_BUILD_TESTS "Build tests" ON)
option(CAPSTONE_USE_DEFAULT_ALLOC "Use default memory allocation functions" ON)

set(SUPPORTED_ARCHITECTURES ARM ARM64 M68K MIPS PPC SPARC SYSZ XCORE X86)
set(SUPPORTED_ARCHITECTURE_LABELS ARM ARM64 M68K MIPS PowerPC Sparc SystemZ XCore x86)
set(SUPPORTED_ARCHITECTURES ARM ARM64 M68K MIPS PPC SPARC SYSZ XCORE X86 TMS320C64X)
set(SUPPORTED_ARCHITECTURE_LABELS ARM ARM64 M68K MIPS PowerPC Sparc SystemZ XCore x86 TMS320C64x)

list(LENGTH SUPPORTED_ARCHITECTURES count)
math(EXPR count "${count}-1")
Expand Down Expand Up @@ -103,6 +103,7 @@ set(HEADERS_COMMON
include/capstone/systemz.h
include/capstone/xcore.h
include/capstone/m68k.h
include/capstone/tms320c64x.h
include/capstone/platform.h
)

Expand Down Expand Up @@ -322,6 +323,26 @@ if (CAPSTONE_M68K_SUPPORT)
set(TEST_SOURCES ${TEST_SOURCES} test_m68k.c)
endif ()

if (CAPSTONE_TMS320C64X_SUPPORT)
add_definitions(-DCAPSTONE_HAS_TMS320C64X)
set(SOURCES_TMS320C64X
arch/TMS320C64x/TMS320C64xDisassembler.c
arch/TMS320C64x/TMS320C64xInstPrinter.c
arch/TMS320C64x/TMS320C64xMapping.c
arch/TMS320C64x/TMS320C64xModule.c
)
set(HEADERS_TMS320C64X
arch/TMS320C64x/TMS320C64xDisassembler.h
arch/TMS320C64x/TMS320C64xGenAsmWriter.inc
arch/TMS320C64x/TMS320C64xGenDisassemblerTables.inc
arch/TMS320C64x/TMS320C64xGenInstrInfo.inc
arch/TMS320C64x/TMS320C64xGenRegisterInfo.inc
arch/TMS320C64x/TMS320C64xInstPrinter.h
arch/TMS320C64x/TMS320C64xMapping.h
)
set(TEST_SOURCES ${TEST_SOURCES} test_tms320c64x.c)
endif ()

if (CAPSTONE_OSXKERNEL_SUPPORT)
add_definitions(-DCAPSTONE_HAS_OSXKERNEL)
endif ()
Expand All @@ -337,6 +358,7 @@ set(ALL_SOURCES
${SOURCES_SYSZ}
${SOURCES_XCORE}
${SOURCES_M68K}
${SOURCES_TMS320C64X}
)

set(ALL_HEADERS
Expand All @@ -351,6 +373,7 @@ set(ALL_HEADERS
${HEADERS_SYSZ}
${HEADERS_XCORE}
${HEADERS_M68K}
${HEADERS_TMS320C64X}
)

include_directories("${PROJECT_SOURCE_DIR}/include")
Expand Down Expand Up @@ -422,6 +445,7 @@ source_group("Source\\SystemZ" FILES ${SOURCES_SYSZ})
source_group("Source\\X86" FILES ${SOURCES_X86})
source_group("Source\\XCore" FILES ${SOURCES_XCORE})
source_group("Source\\M68K" FILES ${SOURCES_M68K})
source_group("Source\\TMS320C64x" FILES ${SOURCES_TMS320C64X})

source_group("Include\\Common" FILES ${HEADERS_COMMON})
source_group("Include\\Engine" FILES ${HEADERS_ENGINE})
Expand All @@ -434,6 +458,7 @@ source_group("Include\\SystemZ" FILES ${HEADERS_SYSZ})
source_group("Include\\X86" FILES ${HEADERS_X86})
source_group("Include\\XCore" FILES ${HEADERS_XCORE})
source_group("Include\\M68K" FILES ${HEADERS_M68K})
source_group("Include\\TMS320C64x" FILES ${HEADERS_TMS320C64X})

## installation
install(FILES ${HEADERS_COMMON} DESTINATION include/capstone)
Expand Down
19 changes: 18 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,25 @@ ifneq (,$(findstring xcore,$(CAPSTONE_ARCHS)))
endif


DEP_TMS320C64X =
DEP_TMS320C64X += arch/TMS320C64x/TMS320C64xGenAsmWriter.inc
DEP_TMS320C64X += arch/TMS320C64x/TMS320C64xGenInstrInfo.inc
DEP_TMS320C64X += arch/TMS320C64x/TMS320C64xGenDisassemblerTables.inc
DEP_TMS320C64X += arch/TMS320C64x/TMS320C64xGenRegisterInfo.inc

LIBOBJ_TMS320C64X =
ifneq (,$(findstring tms320c64x,$(CAPSTONE_ARCHS)))
CFLAGS += -DCAPSTONE_HAS_TMS320C64X
LIBOBJ_TMS320C64X += $(OBJDIR)/arch/TMS320C64x/TMS320C64xDisassembler.o
LIBOBJ_TMS320C64X += $(OBJDIR)/arch/TMS320C64x/TMS320C64xInstPrinter.o
LIBOBJ_TMS320C64X += $(OBJDIR)/arch/TMS320C64x/TMS320C64xMapping.o
LIBOBJ_TMS320C64X += $(OBJDIR)/arch/TMS320C64x/TMS320C64xModule.o
endif


LIBOBJ =
LIBOBJ += $(OBJDIR)/cs.o $(OBJDIR)/utils.o $(OBJDIR)/SStream.o $(OBJDIR)/MCInstrDesc.o $(OBJDIR)/MCRegisterInfo.o
LIBOBJ += $(LIBOBJ_ARM) $(LIBOBJ_ARM64) $(LIBOBJ_M68K) $(LIBOBJ_MIPS) $(LIBOBJ_PPC) $(LIBOBJ_SPARC) $(LIBOBJ_SYSZ) $(LIBOBJ_X86) $(LIBOBJ_XCORE)
LIBOBJ += $(LIBOBJ_ARM) $(LIBOBJ_ARM64) $(LIBOBJ_M68K) $(LIBOBJ_MIPS) $(LIBOBJ_PPC) $(LIBOBJ_SPARC) $(LIBOBJ_SYSZ) $(LIBOBJ_X86) $(LIBOBJ_XCORE) $(LIBOBJ_TMS320C64X)
LIBOBJ += $(OBJDIR)/MCInst.o


Expand Down Expand Up @@ -389,6 +405,7 @@ $(LIBOBJ_SPARC): $(DEP_SPARC)
$(LIBOBJ_SYSZ): $(DEP_SYSZ)
$(LIBOBJ_X86): $(DEP_X86)
$(LIBOBJ_XCORE): $(DEP_XCORE)
$(LIBOBJ_TMS320C64X): $(DEP_TMS320C64X)

ifeq ($(CAPSTONE_STATIC),yes)
$(ARCHIVE): $(LIBOBJ)
Expand Down
Loading

0 comments on commit 0850d55

Please sign in to comment.