Skip to content

Commit

Permalink
This adds M68K support to Capstone
Browse files Browse the repository at this point in the history
  • Loading branch information
emoon committed Oct 2, 2015
1 parent cf7627d commit 2ee675c
Show file tree
Hide file tree
Showing 33 changed files with 7,111 additions and 20 deletions.
19 changes: 17 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 MIPS PPC SPARC SYSZ XCORE X86)
set(SUPPORTED_ARCHITECTURE_LABELS ARM ARM64 MIPS PowerPC Sparc SystemZ XCore x86)
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)

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

Expand Down Expand Up @@ -309,6 +310,19 @@ if (CAPSTONE_XCORE_SUPPORT)
set(TEST_SOURCES ${TEST_SOURCES} test_xcore.c)
endif ()

if (CAPSTONE_M68K_SUPPORT)
add_definitions(-DCAPSTONE_HAS_M68K)
set(SOURCES_M68K
arch/M68K/M68Kdasm.c
arch/M68K/M68KDisassembler.c
arch/M68K/M68KModule.c
)
set(HEADERS_M68K
arch/M68K/M68KDisassembler.h
)
set(TEST_SOURCES ${TEST_SOURCES} test_m68k.c)
endif ()

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

set(ALL_HEADERS
Expand Down
1 change: 1 addition & 0 deletions COMPILE_CMAKE.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Get CMake for free from http://www.cmake.org.
- CAPSTONE_SPARC_SUPPORT: support Sparc. Run cmake with -DCAPSTONE_SPARC_SUPPORT=0 to remove Sparc.
- CAPSTONE_SYSZ_SUPPORT: support SystemZ. Run cmake with -DCAPSTONE_SYSZ_SUPPORT=0 to remove SystemZ.
- CAPSTONE_XCORE_SUPPORT: support XCore. Run cmake with -DCAPSTONE_XCORE_SUPPORT=0 to remove XCore.
- CAPSTONE_M68K_SUPPORT: support M68K. Run cmake with -DCAPSTONE_M68K_SUPPORT=0 to remove M68K.
- CAPSTONE_X86_SUPPORT: support X86. Run cmake with -DCAPSTONE_X86_SUPPORT=0 to remove X86.

By default, all 8 architectures are compiled in.
Expand Down
20 changes: 17 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,19 @@ ifneq (,$(findstring aarch64,$(CAPSTONE_ARCHS)))
endif


DEP_M68K =
DEP_M68K += arch/M68K/M68Kconf.h
DEP_M68K += arch/M68K/M68Kdasm.h
DEP_M68K += arch/M68K/M68KDisassembler.h

LIBOBJ_M68K =
ifneq (,$(findstring m68k,$(CAPSTONE_ARCHS)))
CFLAGS += -DCAPSTONE_HAS_M68K
LIBOBJ_M68K += $(OBJDIR)/arch/M68K/M68Kdasm.o
LIBOBJ_M68K += $(OBJDIR)/arch/M68K/M68KDisassembler.o
LIBOBJ_M68K += $(OBJDIR)/arch/M68K/M68KModule.o
endif

DEP_MIPS =
DEP_MIPS += arch/Mips/MipsGenAsmWriter.inc
DEP_MIPS += arch/Mips/MipsGenDisassemblerTables.inc
Expand Down Expand Up @@ -254,7 +267,7 @@ endif

LIBOBJ =
LIBOBJ += $(OBJDIR)/cs.o $(OBJDIR)/utils.o $(OBJDIR)/SStream.o $(OBJDIR)/MCInstrDesc.o $(OBJDIR)/MCRegisterInfo.o
LIBOBJ += $(LIBOBJ_ARM) $(LIBOBJ_ARM64) $(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 += $(OBJDIR)/MCInst.o


Expand Down Expand Up @@ -361,6 +374,7 @@ $(LIBOBJ): config.mk

$(LIBOBJ_ARM): $(DEP_ARM)
$(LIBOBJ_ARM64): $(DEP_ARM64)
$(LIBOBJ_M68K): $(DEP_M68K)
$(LIBOBJ_MIPS): $(DEP_MIPS)
$(LIBOBJ_PPC): $(DEP_PPC)
$(LIBOBJ_SPARC): $(DEP_SPARC)
Expand Down Expand Up @@ -443,10 +457,10 @@ dist:
git archive --format=zip --prefix=capstone-$(DIST_VERSION)/ $(TAG) > capstone-$(DIST_VERSION).zip


TESTS = test test_detail test_arm test_arm64 test_mips test_ppc test_sparc
TESTS = test test_detail test_arm test_arm64 test_m68k test_mips test_ppc test_sparc
TESTS += test_systemz test_x86 test_xcore test_iter
TESTS += test.static test_detail.static test_arm.static test_arm64.static
TESTS += test_mips.static test_ppc.static test_sparc.static
TESTS += test_m68k.static test_mips.static test_ppc.static test_sparc.static
TESTS += test_systemz.static test_x86.static test_xcore.static
TESTS += test_skipdata test_skipdata.static test_iter.static
check:
Expand Down
Loading

0 comments on commit 2ee675c

Please sign in to comment.