add Ethereum VM architecture
diff --git a/.gitignore b/.gitignore
index 3e846c3..ec5bc8d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -67,6 +67,7 @@
tests/test_m68k
tests/test_tms320c64x
tests/test_m680x
+tests/test_evm
# vim tmp file
*.swp
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f6d580c..580a0ab 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,8 +27,8 @@
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 TMS320C64X M680X)
-set(SUPPORTED_ARCHITECTURE_LABELS ARM ARM64 M68K MIPS PowerPC Sparc SystemZ XCore x86 TMS320C64x M680x)
+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)
list(LENGTH SUPPORTED_ARCHITECTURES count)
math(EXPR count "${count}-1")
@@ -364,6 +364,23 @@
set(TEST_SOURCES ${TEST_SOURCES} test_m680x.c)
endif ()
+if (CAPSTONE_EVM_SUPPORT)
+ add_definitions(-DCAPSTONE_HAS_EVM)
+ set(SOURCES_EVM
+ arch/EVM/EVMDisassembler.c
+ arch/EVM/EVMInstPrinter.c
+ arch/EVM/EVMMapping.c
+ arch/EVM/EVMModule.c
+ )
+ set(HEADERS_EVM
+ arch/EVM/EVMDisassembler.h
+ arch/EVM/EVMInstPrinter.h
+ arch/EVM/EVMMapping.h
+ arch/EVM/EVMMappingInsn.inc
+ )
+ set(TEST_SOURCES ${TEST_SOURCES} test_evm.c)
+endif ()
+
if (CAPSTONE_OSXKERNEL_SUPPORT)
add_definitions(-DCAPSTONE_HAS_OSXKERNEL)
endif ()
@@ -381,6 +398,7 @@
${SOURCES_M68K}
${SOURCES_TMS320C64X}
${SOURCES_M680X}
+ ${SOURCES_EVM}
)
set(ALL_HEADERS
@@ -397,6 +415,7 @@
${HEADERS_M68K}
${HEADERS_TMS320C64X}
${HEADERS_M680X}
+ ${HEADERS_EVM}
)
include_directories("${PROJECT_SOURCE_DIR}/include")
@@ -473,6 +492,7 @@
source_group("Source\\M68K" FILES ${SOURCES_M68K})
source_group("Source\\TMS320C64x" FILES ${SOURCES_TMS320C64X})
source_group("Source\\M680X" FILES ${SOURCES_M680X})
+source_group("Source\\EVM" FILES ${SOURCES_EVM})
source_group("Include\\Common" FILES ${HEADERS_COMMON})
source_group("Include\\Engine" FILES ${HEADERS_ENGINE})
@@ -487,6 +507,7 @@
source_group("Include\\M68K" FILES ${HEADERS_M68K})
source_group("Include\\TMS320C64x" FILES ${HEADERS_TMS320C64X})
source_group("Include\\M680X" FILES ${HEADERS_MC680X})
+source_group("Include\\EVM" FILES ${HEADERS_EVM})
### test library 64bit routine:
get_property(LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
diff --git a/COMPILE.TXT b/COMPILE.TXT
index 93056ce..56aecad 100644
--- a/COMPILE.TXT
+++ b/COMPILE.TXT
@@ -17,12 +17,12 @@
(0) Tailor Capstone to your need.
- Out of 9 archtitectures supported by Capstone (Arm, Arm64, M68K, Mips, PPC,
- Sparc, SystemZ, XCore & X86), if you just need several selected archs, choose
- which ones you want to compile in by editing "config.mk" before going to
- next steps.
+ Out of 12 archtitectures supported by Capstone (Arm, Arm64, M68K, Mips, PPC,
+ Sparc, SystemZ, XCore, X86, M680X, TMS320C64x & EVM), if you just need several
+ selected archs, choose the ones you want to compile in by editing "config.mk"
+ before going to next steps.
- By default, all 9 architectures are compiled.
+ By default, all 12 architectures are compiled.
The other way of customize Capstone without having to edit config.mk is to
pass the desired options on the commandline to ./make.sh. Currently,
@@ -87,11 +87,14 @@
/usr/include/capstone/x86.h
/usr/include/capstone/arm.h
/usr/include/capstone/arm64.h
+ /usr/include/capstone/evm.h
/usr/include/capstone/m68k.h
+ /usr/include/capstone/m680x.h
/usr/include/capstone/mips.h
/usr/include/capstone/ppc.h
/usr/include/capstone/sparc.h
/usr/include/capstone/systemz.h
+ /usr/include/capstone/tms320c64x.h
/usr/include/capstone/xcore.h
/usr/include/capstone/platform.h
/usr/lib/libcapstone.so (for Linux/*nix), or /usr/lib/libcapstone.dylib (OSX)
diff --git a/COMPILE_CMAKE.TXT b/COMPILE_CMAKE.TXT
index 8555d1a..6b35d8d 100644
--- a/COMPILE_CMAKE.TXT
+++ b/COMPILE_CMAKE.TXT
@@ -16,8 +16,8 @@
(0) Tailor Capstone to your need.
- Out of 9 archtitectures supported by Capstone (Arm, Arm64, M68K, Mips, PPC,
- Sparc, SystemZ, X86 & XCore), if you just need several selected archs,
+ Out of 12 archtitectures supported by Capstone (Arm, Arm64, M68K, Mips, PPC,
+ Sparc, SystemZ, X86, XCore, M680X, TMS320C64x & EVM), if you just need several selected archs,
run "cmake" with the unwanted archs disabled (set to 0) as followings.
- CAPSTONE_ARM_SUPPORT: support ARM. Run cmake with -DCAPSTONE_ARM_SUPPORT=0 to remove ARM.
@@ -30,6 +30,9 @@
- 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_X86_SUPPORT: support X86. Run cmake with -DCAPSTONE_X86_SUPPORT=0 to remove X86.
+ - CAPSTONE_X86_TMS320C64X: support TMS320C64X. Run cmake with -DCAPSTONE_TMS320C64X_SUPPORT=0 to remove TMS320C64X.
+ - CAPSTONE_X86_M680X: support M680X. Run cmake with -DCAPSTONE_M680X_SUPPORT=0 to remove M680X.
+ - CAPSTONE_X86_EVM: support EVM. Run cmake with -DCAPSTONE_EVM_SUPPORT=0 to remove EVM.
By default, all 10 architectures are compiled in.
diff --git a/MCInst.h b/MCInst.h
index befb5e9..6a70741 100644
--- a/MCInst.h
+++ b/MCInst.h
@@ -109,6 +109,7 @@
uint8_t ac_idx;
uint8_t popcode_adjust; // Pseudo X86 instruction adjust
char assembly[8]; // for special instruction, so that we dont need printer
+ unsigned char evm_data[32]; // for EVM PUSH operand
};
void MCInst_Init(MCInst *inst);
diff --git a/Makefile b/Makefile
index 8df3f40..e9838e2 100644
--- a/Makefile
+++ b/Makefile
@@ -235,9 +235,21 @@
LIBOBJ_M680X += $(LIBSRC_M680X:%.c=$(OBJDIR)/%.o)
endif
+
+DEP_EVM =
+DEP_EVM += $(wildcard arch/EVM/EVM*.inc)
+
+LIBOBJ_EVM =
+ifneq (,$(findstring evm,$(CAPSTONE_ARCHS)))
+ CFLAGS += -DCAPSTONE_HAS_EVM
+ LIBSRC_EVM += $(wildcard arch/EVM/EVM*.c)
+ LIBOBJ_EVM += $(LIBSRC_EVM:%.c=$(OBJDIR)/%.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_TMS320C64X) $(LIBOBJ_M680X)
+LIBOBJ += $(LIBOBJ_ARM) $(LIBOBJ_ARM64) $(LIBOBJ_M68K) $(LIBOBJ_MIPS) $(LIBOBJ_PPC) $(LIBOBJ_SPARC) $(LIBOBJ_SYSZ) $(LIBOBJ_X86) $(LIBOBJ_XCORE) $(LIBOBJ_TMS320C64X) $(LIBOBJ_M680X) $(LIBOBJ_EVM)
LIBOBJ += $(OBJDIR)/MCInst.o
@@ -363,6 +375,7 @@
$(LIBOBJ_XCORE): $(DEP_XCORE)
$(LIBOBJ_TMS320C64X): $(DEP_TMS320C64X)
$(LIBOBJ_M680X): $(DEP_M680X)
+$(LIBOBJ_EVM): $(DEP_EVM)
ifeq ($(CAPSTONE_STATIC),yes)
$(ARCHIVE): $(LIBOBJ)
diff --git a/README.md b/README.md
index 39a069e..e25acef 100644
--- a/README.md
+++ b/README.md
@@ -10,8 +10,8 @@
Created by Nguyen Anh Quynh, then developed and maintained by a small community,
Capstone offers some unparalleled features:
-- Support multiple hardware architectures: ARM, ARM64 (ARMv8), M68K, Mips, PPC,
- Sparc, SystemZ, TMS320C64X, M680X, XCore and X86 (including X86_64).
+- Support multiple hardware architectures: ARM, ARM64 (ARMv8), Ethereum VM, M68K,
+ Mips, PPC, Sparc, SystemZ, TMS320C64X, M680X, XCore and X86 (including X86_64).
- Having clean/simple/lightweight/intuitive architecture-neutral API.
diff --git a/bindings/const_generator.py b/bindings/const_generator.py
index a8d3b1f..2c76090 100644
--- a/bindings/const_generator.py
+++ b/bindings/const_generator.py
@@ -5,7 +5,7 @@
INCL_DIR = '../include/capstone/'
-include = [ 'arm.h', 'arm64.h', 'm68k.h', 'mips.h', 'x86.h', 'ppc.h', 'sparc.h', 'systemz.h', 'xcore.h', 'tms320c64x.h', 'm680x.h' ]
+include = [ 'arm.h', 'arm64.h', 'm68k.h', 'mips.h', 'x86.h', 'ppc.h', 'sparc.h', 'systemz.h', 'xcore.h', 'tms320c64x.h', 'm680x.h', 'evm.h' ]
template = {
'java': {
@@ -25,6 +25,7 @@
'xcore.h': 'Xcore',
'tms320c64x.h': 'TMS320C64x',
'm680x.h': 'M680x',
+ 'evm.h': 'Evm',
'comment_open': '\t//',
'comment_close': '',
},
@@ -45,6 +46,7 @@
'xcore.h': 'xcore',
'tms320c64x.h': 'tms320c64x',
'm680x.h': 'm680x',
+ 'evm.h': 'evm',
'comment_open': '#',
'comment_close': '',
},
@@ -65,6 +67,7 @@
'xcore.h': 'xcore',
'tms320c64x.h': 'tms320c64x',
'm680x.h': 'm680x',
+ 'evm.h': 'evm',
'comment_open': '(*',
'comment_close': ' *)',
},
diff --git a/bindings/python/capstone/__init__.py b/bindings/python/capstone/__init__.py
index b8bb15b..a9ae8fe 100644
--- a/bindings/python/capstone/__init__.py
+++ b/bindings/python/capstone/__init__.py
@@ -34,6 +34,7 @@
'CS_ARCH_M68K',
'CS_ARCH_TMS320C64X',
'CS_ARCH_M680X',
+ 'CS_ARCH_EVM',
'CS_ARCH_ALL',
'CS_MODE_LITTLE_ENDIAN',
@@ -149,7 +150,8 @@
CS_ARCH_M68K = 8
CS_ARCH_TMS320C64X = 9
CS_ARCH_M680X = 10
-CS_ARCH_MAX = 11
+CS_ARCH_EVM = 11
+CS_ARCH_MAX = 12
CS_ARCH_ALL = 0xFFFF
# disasm mode
@@ -327,7 +329,7 @@
return [copy_ctypes(n) for n in src]
# Weird import placement because these modules are needed by the below code but need the above functions
-from . import arm, arm64, m68k, mips, ppc, sparc, systemz, x86, xcore, tms320c64x, m680x
+from . import arm, arm64, m68k, mips, ppc, sparc, systemz, x86, xcore, tms320c64x, m680x, evm
class _cs_arch(ctypes.Union):
_fields_ = (
@@ -342,6 +344,7 @@
('xcore', xcore.CsXcore),
('tms320c64x', tms320c64x.CsTMS320C64x),
('m680x', m680x.CsM680x),
+ ('evm', evm.CsEvm),
)
class _cs_detail(ctypes.Structure):
@@ -648,6 +651,8 @@
(self.condition, self.funit, self.parallel, self.operands) = tms320c64x.get_arch_info(self._raw.detail.contents.arch.tms320c64x)
elif arch == CS_ARCH_M680X:
(self.flags, self.operands) = m680x.get_arch_info(self._raw.detail.contents.arch.m680x)
+ elif arch == CS_ARCH_EVM:
+ (self.pop, self.push, self.fee) = evm.get_arch_info(self._raw.detail.contents.arch.evm)
def __getattr__(self, name):
@@ -1072,7 +1077,7 @@
archs = { "arm": CS_ARCH_ARM, "arm64": CS_ARCH_ARM64, "m68k": CS_ARCH_M68K, \
"mips": CS_ARCH_MIPS, "ppc": CS_ARCH_PPC, "sparc": CS_ARCH_SPARC, \
"sysz": CS_ARCH_SYSZ, 'xcore': CS_ARCH_XCORE, "tms320c64x": CS_ARCH_TMS320C64X, \
- "m680x": CS_ARCH_M680X }
+ "m680x": CS_ARCH_M680X, 'evm': CS_ARCH_EVM }
all_archs = ""
keys = archs.keys()
diff --git a/bindings/python/setup_cython.py b/bindings/python/setup_cython.py
index 289b58e..d36769a 100644
--- a/bindings/python/setup_cython.py
+++ b/bindings/python/setup_cython.py
@@ -40,7 +40,7 @@
compile_args = ['-O3', '-fomit-frame-pointer', '-I' + HEADERS_DIR]
link_args = ['-L' + LIBS_DIR]
-ext_module_names = ['arm', 'arm_const', 'arm64', 'arm64_const', 'm68k', 'm68k_const', 'm680x', 'm680x_const', 'mips', 'mips_const', 'ppc', 'ppc_const', 'x86', 'x86_const', 'sparc', 'sparc_const', 'systemz', 'sysz_const', 'xcore', 'xcore_const', 'tms320c64x', 'tms320c64x_const']
+ext_module_names = ['arm', 'arm_const', 'arm64', 'arm64_const', 'm68k', 'm68k_const', 'm680x', 'm680x_const', 'mips', 'mips_const', 'ppc', 'ppc_const', 'x86', 'x86_const', 'sparc', 'sparc_const', 'systemz', 'sysz_const', 'xcore', 'xcore_const', 'tms320c64x', 'tms320c64x_const', 'evm', 'evm_const' ]
ext_modules = [Extension("capstone.ccapstone",
["pyx/ccapstone.pyx"],
diff --git a/config.mk b/config.mk
index 546d433..3b078a7 100644
--- a/config.mk
+++ b/config.mk
@@ -4,7 +4,7 @@
################################################################################
# Specify which archs you want to compile in. By default, we build all archs.
-CAPSTONE_ARCHS ?= arm aarch64 m68k mips powerpc sparc systemz x86 xcore tms320c64x m680x
+CAPSTONE_ARCHS ?= arm aarch64 m68k mips powerpc sparc systemz x86 xcore tms320c64x m680x evm
################################################################################
diff --git a/cs.c b/cs.c
index f240457..2b53ac7 100644
--- a/cs.c
+++ b/cs.c
@@ -66,6 +66,7 @@
extern void SystemZ_enable(void);
extern void XCore_enable(void);
extern void TMS320C64x_enable(void);
+extern void EVM_enable(void);
static void archs_enable(void)
{
@@ -107,6 +108,9 @@
#ifdef CAPSTONE_HAS_TMS320C64X
TMS320C64x_enable();
#endif
+#ifdef CAPSTONE_HAS_EVM
+ EVM_enable();
+#endif
initialized = true;
@@ -187,7 +191,7 @@
(1 << CS_ARCH_PPC) | (1 << CS_ARCH_SPARC) |
(1 << CS_ARCH_SYSZ) | (1 << CS_ARCH_XCORE) |
(1 << CS_ARCH_M68K) | (1 << CS_ARCH_TMS320C64X) |
- (1 << CS_ARCH_M680X));
+ (1 << CS_ARCH_M680X) | (1 << CS_ARCH_EVM));
if ((unsigned int)query < CS_ARCH_MAX)
return all_arch & (1 << query);
@@ -447,6 +451,9 @@
case CS_ARCH_M680X:
// M680X alignment is 1.
return 1;
+ case CS_ARCH_EVM:
+ // EVM alignment is 1.
+ return 1;
}
}
@@ -1153,6 +1160,13 @@
if (insn->detail->m680x.operands[i].type == (m680x_op_type)op_type)
count++;
break;
+ case CS_ARCH_EVM:
+#if 0
+ for (i = 0; i < insn->detail->evm.op_count; i++)
+ if (insn->detail->evm.operands[i].type == (evm_op_type)op_type)
+ count++;
+#endif
+ break;
}
return count;
@@ -1278,6 +1292,16 @@
return i;
}
break;
+ case CS_ARCH_EVM:
+#if 0
+ for (i = 0; i < insn->detail->evm.op_count; i++) {
+ if (insn->detail->evm.operands[i].type == (evm_op_type)op_type)
+ count++;
+ if (count == post)
+ return i;
+ }
+#endif
+ break;
}
return -1;
diff --git a/cstool/cstool.c b/cstool/cstool.c
index 9933b28..cd3483e 100644
--- a/cstool/cstool.c
+++ b/cstool/cstool.c
@@ -55,6 +55,7 @@
{ "hd6301", CS_ARCH_M680X, CS_MODE_M680X_6301 },
{ "hd6309", CS_ARCH_M680X, CS_MODE_M680X_6309 },
{ "hcs08", CS_ARCH_M680X, CS_MODE_M680X_HCS08 },
+ { "evm", CS_ARCH_EVM, 0 },
{ NULL }
};
@@ -69,6 +70,8 @@
void print_insn_detail_m68k(csh handle, cs_insn *ins);
void print_insn_detail_tms320c64x(csh handle, cs_insn *ins);
void print_insn_detail_m680x(csh handle, cs_insn *ins);
+void print_insn_detail_evm(csh handle, cs_insn *ins);
+
static void print_details(csh handle, cs_arch arch, cs_mode md, cs_insn *ins);
void print_string_hex(char *comment, unsigned char *str, size_t len)
@@ -178,7 +181,7 @@
if (cs_support(CS_ARCH_XCORE)) {
printf(" xcore: xcore\n");
}
-
+
if (cs_support(CS_ARCH_M68K)) {
printf(" m68k: m68k + big endian\n");
printf(" m68k40: m68k_040\n");
@@ -188,18 +191,22 @@
printf(" tms320c64x:TMS320C64x\n");
}
- if (cs_support(CS_ARCH_M680X)) {
- printf(" m6800: M6800/2\n");
- printf(" m6801: M6801/3\n");
- printf(" m6805: M6805\n");
- printf(" m6808: M68HC08\n");
- printf(" m6809: M6809\n");
- printf(" m6811: M68HC11\n");
- printf(" cpu12: M68HC12/HCS12\n");
- printf(" hd6301: HD6301/3\n");
- printf(" hd6309: HD6309\n");
- printf(" hcs08: HCS08\n");
- }
+ if (cs_support(CS_ARCH_M680X)) {
+ printf(" m6800: M6800/2\n");
+ printf(" m6801: M6801/3\n");
+ printf(" m6805: M6805\n");
+ printf(" m6808: M68HC08\n");
+ printf(" m6809: M6809\n");
+ printf(" m6811: M68HC11\n");
+ printf(" cpu12: M68HC12/HCS12\n");
+ printf(" hd6301: HD6301/3\n");
+ printf(" hd6309: HD6309\n");
+ printf(" hcs08: HCS08\n");
+ }
+
+ if (cs_support(CS_ARCH_EVM)) {
+ printf(" evm: Ethereum Virtual Machine\n");
+ }
printf("\nExtra options:\n");
printf(" -d show detailed information of the instructions\n");
@@ -239,8 +246,11 @@
case CS_ARCH_TMS320C64X:
print_insn_detail_tms320c64x(handle, ins);
break;
- case CS_ARCH_M680X:
- print_insn_detail_m680x(handle, ins);
+ case CS_ARCH_M680X:
+ print_insn_detail_m680x(handle, ins);
+ break;
+ case CS_ARCH_EVM:
+ print_insn_detail_evm(handle, ins);
break;
default: break;
}
@@ -276,21 +286,21 @@
while ((c = getopt (argc, argv, "udhv")) != -1) {
switch (c) {
- case 'u':
- unsigned_flag = true;
- break;
- case 'd':
- detail_flag = true;
- break;
- case 'v':
- printf("%u.%u.%u\n", CS_VERSION_MAJOR, CS_VERSION_MINOR, CS_VERSION_EXTRA);
- return 0;
- case 'h':
- usage(argv[0]);
- return 0;
- default:
- usage(argv[0]);
- return -1;
+ case 'u':
+ unsigned_flag = true;
+ break;
+ case 'd':
+ detail_flag = true;
+ break;
+ case 'v':
+ printf("%u.%u.%u\n", CS_VERSION_MAJOR, CS_VERSION_MINOR, CS_VERSION_EXTRA);
+ return 0;
+ case 'h':
+ usage(argv[0]);
+ return 0;
+ default:
+ usage(argv[0]);
+ return -1;
}
}
diff --git a/include/capstone/capstone.h b/include/capstone/capstone.h
index f3ad794..39b18c9 100644
--- a/include/capstone/capstone.h
+++ b/include/capstone/capstone.h
@@ -83,6 +83,7 @@
CS_ARCH_M68K, // 68K architecture
CS_ARCH_TMS320C64X, // TMS320C64x architecture
CS_ARCH_M680X, // 680X architecture
+ CS_ARCH_EVM, // Ethereum architecture
CS_ARCH_MAX,
CS_ARCH_ALL = 0xFFFF, // All architectures - for cs_support()
} cs_arch;
@@ -255,6 +256,7 @@
// SystemZ: 2 bytes.
// X86: 1 bytes.
// XCore: 2 bytes.
+ // EVM: 1 bytes.
cs_skipdata_cb_t callback; // default value is NULL
// User-defined data to be passed to @callback function pointer.
@@ -273,6 +275,7 @@
#include "xcore.h"
#include "tms320c64x.h"
#include "m680x.h"
+#include "evm.h"
// NOTE: All information in cs_detail is only available when CS_OPT_DETAIL = CS_OPT_ON
typedef struct cs_detail {
@@ -287,17 +290,18 @@
// Architecture-specific instruction info
union {
- cs_x86 x86; // X86 architecture, including 16-bit, 32-bit & 64-bit mode
- cs_arm64 arm64; // ARM64 architecture (aka AArch64)
- cs_arm arm; // ARM architecture (including Thumb/Thumb2)
- cs_m68k m68k; // M68K architecture
- cs_mips mips; // MIPS architecture
- cs_ppc ppc; // PowerPC architecture
- cs_sparc sparc; // Sparc architecture
- cs_sysz sysz; // SystemZ architecture
- cs_xcore xcore; // XCore architecture
- cs_tms320c64x tms320c64x; // TMS320C64x architecture
- cs_m680x m680x; // M680X architecture
+ cs_x86 x86; // X86 architecture, including 16-bit, 32-bit & 64-bit mode
+ cs_arm64 arm64; // ARM64 architecture (aka AArch64)
+ cs_arm arm; // ARM architecture (including Thumb/Thumb2)
+ cs_m68k m68k; // M68K architecture
+ cs_mips mips; // MIPS architecture
+ cs_ppc ppc; // PowerPC architecture
+ cs_sparc sparc; // Sparc architecture
+ cs_sysz sysz; // SystemZ architecture
+ cs_xcore xcore; // XCore architecture
+ cs_tms320c64x tms320c64x; // TMS320C64x architecture
+ cs_m680x m680x; // M680X architecture
+ cs_evm evm; // Ethereum architecture
};
} cs_detail;
diff --git a/tests/Makefile b/tests/Makefile
index 57d9065..d3c392a 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -109,6 +109,10 @@
CFLAGS += -DCAPSTONE_HAS_M680X
SOURCES += test_m680x.c
endif
+ifneq (,$(findstring evm,$(CAPSTONE_ARCHS)))
+CFLAGS += -DCAPSTONE_HAS_EVM
+SOURCES += test_evm.c
+endif
OBJS = $(addprefix $(OBJDIR)/,$(SOURCES:.c=.o))
BINARY = $(addprefix $(TESTDIR)/,$(SOURCES:.c=$(BIN_EXT)))
diff --git a/tests/test_arm.c b/tests/test_arm.c
index 5069778..d021dff 100644
--- a/tests/test_arm.c
+++ b/tests/test_arm.c
@@ -1,5 +1,5 @@
/* Capstone Disassembler Engine */
-/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013> */
+/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013 */
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/test_arm64.c b/tests/test_arm64.c
index 46cc3c1..fc8f7e6 100644
--- a/tests/test_arm64.c
+++ b/tests/test_arm64.c
@@ -1,5 +1,5 @@
/* Capstone Disassembler Engine */
-/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013> */
+/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013 */
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/test_basic.c b/tests/test_basic.c
index 40e24c5..56dbd2f 100644
--- a/tests/test_basic.c
+++ b/tests/test_basic.c
@@ -1,5 +1,5 @@
/* Capstone Disassembler Engine */
-/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013> */
+/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013 */
#include <stdio.h>
#include <stdlib.h>
@@ -81,6 +81,9 @@
#ifdef CAPSTONE_HAS_M680X
#define M680X_CODE "\x06\x10\x19\x1a\x55\x1e\x01\x23\xe9\x31\x06\x34\x55\xa6\x81\xa7\x89\x7f\xff\xa6\x9d\x10\x00\xa7\x91\xa6\x9f\x10\x00\x11\xac\x99\x10\x00\x39"
#endif
+#ifdef CAPSTONE_HAS_EVM
+#define EVM_CODE "\x60\x61"
+#endif
struct platform {
@@ -303,6 +306,15 @@
"M680X_M6809",
},
#endif
+#ifdef CAPSTONE_HAS_EVM
+ {
+ CS_ARCH_EVM,
+ 0,
+ (unsigned char*)EVM_CODE,
+ sizeof(EVM_CODE) - 1,
+ "EVM",
+ },
+#endif
};
csh handle;
diff --git a/tests/test_detail.c b/tests/test_detail.c
index d9a48dd..48af3b9 100644
--- a/tests/test_detail.c
+++ b/tests/test_detail.c
@@ -1,5 +1,5 @@
/* Capstone Disassembler Engine */
-/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013> */
+/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013 */
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/test_iter.c b/tests/test_iter.c
index ec258a7..6c9169b 100644
--- a/tests/test_iter.c
+++ b/tests/test_iter.c
@@ -1,5 +1,5 @@
/* Capstone Disassembler Engine */
-/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013> */
+/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013 */
// This sample code demonstrates the APIs cs_malloc() & cs_disasm_iter().
#include <stdio.h>
diff --git a/tests/test_mips.c b/tests/test_mips.c
index 2a95b83..d3864bd 100644
--- a/tests/test_mips.c
+++ b/tests/test_mips.c
@@ -1,5 +1,5 @@
/* Capstone Disassembler Engine */
-/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013> */
+/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013 */
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/test_ppc.c b/tests/test_ppc.c
index 31e597f..0ad5de3 100644
--- a/tests/test_ppc.c
+++ b/tests/test_ppc.c
@@ -1,5 +1,5 @@
/* Capstone Disassembler Engine */
-/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013> */
+/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013 */
#include <stdio.h>
diff --git a/tests/test_skipdata.c b/tests/test_skipdata.c
index 11270ff..5217210 100644
--- a/tests/test_skipdata.c
+++ b/tests/test_skipdata.c
@@ -1,5 +1,5 @@
/* Capstone Disassembler Engine */
-/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013> */
+/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013 */
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/test_x86.c b/tests/test_x86.c
index 0e86b46..0281fa9 100644
--- a/tests/test_x86.c
+++ b/tests/test_x86.c
@@ -1,5 +1,5 @@
/* Capstone Disassembler Engine */
-/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013> */
+/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013 */
#include <stdio.h>
#include <stdlib.h>