Merge branch 'feature/x86-groups' of https://github.com/parasyte/capstone into test
diff --git a/README b/README
index 01e07dd..ceefbc0 100644
--- a/README
+++ b/README
@@ -44,8 +44,8 @@
binary code that Capstone cannot disassemble, or does that wrongly, so we can
fix that in the next version
-- This package only contains Java & Python bindings. For C#, Go, Ocaml & Ruby,
-refer to the corresponding git repositories.
+- This package only contains Java & Python bindings. For more bindings created
+and maintained by the community, see bindings/README.
[Hack]
diff --git a/arch/X86/X86ATTInstPrinter.c b/arch/X86/X86ATTInstPrinter.c
index d2fa43b..3891fad 100644
--- a/arch/X86/X86ATTInstPrinter.c
+++ b/arch/X86/X86ATTInstPrinter.c
@@ -45,50 +45,37 @@
static void printopaquemem(MCInst *MI, unsigned OpNo, SStream *O)
{
- SStream_concat(O, "ptr ");
printMemReference(MI, OpNo, O);
}
static void printi8mem(MCInst *MI, unsigned OpNo, SStream *O)
{
- SStream_concat(O, "byte ptr ");
printMemReference(MI, OpNo, O);
}
static void printi16mem(MCInst *MI, unsigned OpNo, SStream *O)
{
- if (MI->Opcode == X86_BOUNDS16rm)
- SStream_concat(O, "dword ptr ");
- else
- SStream_concat(O, "word ptr ");
printMemReference(MI, OpNo, O);
}
static void printi32mem(MCInst *MI, unsigned OpNo, SStream *O)
{
- if (MI->Opcode == X86_BOUNDS32rm)
- SStream_concat(O, "qword ptr ");
- else
- SStream_concat(O, "dword ptr ");
printMemReference(MI, OpNo, O);
}
static void printi64mem(MCInst *MI, unsigned OpNo, SStream *O)
{
- SStream_concat(O, "qword ptr ");
printMemReference(MI, OpNo, O);
}
static void printi128mem(MCInst *MI, unsigned OpNo, SStream *O)
{
- SStream_concat(O, "xmmword ptr ");
printMemReference(MI, OpNo, O);
}
#ifndef CAPSTONE_X86_REDUCE
static void printi256mem(MCInst *MI, unsigned OpNo, SStream *O)
{
- SStream_concat(O, "ymmword ptr ");
printMemReference(MI, OpNo, O);
}
@@ -99,31 +86,26 @@
static void printf32mem(MCInst *MI, unsigned OpNo, SStream *O)
{
- SStream_concat(O, "dword ptr ");
printMemReference(MI, OpNo, O);
}
static void printf64mem(MCInst *MI, unsigned OpNo, SStream *O)
{
- SStream_concat(O, "qword ptr ");
printMemReference(MI, OpNo, O);
}
static void printf80mem(MCInst *MI, unsigned OpNo, SStream *O)
{
- SStream_concat(O, "xword ptr ");
printMemReference(MI, OpNo, O);
}
static void printf128mem(MCInst *MI, unsigned OpNo, SStream *O)
{
- SStream_concat(O, "xmmword ptr ");
printMemReference(MI, OpNo, O);
}
static void printf256mem(MCInst *MI, unsigned OpNo, SStream *O)
{
- SStream_concat(O, "ymmword ptr ");
printMemReference(MI, OpNo, O);
}
diff --git a/bindings/README b/bindings/README
new file mode 100644
index 0000000..5f9ab8d
--- /dev/null
+++ b/bindings/README
@@ -0,0 +1,23 @@
+This directory contains bindings for Python, Java & OCaml.
+
+More bindings created & maintained by the community are available as followings.
+
+- Gapstone: Go binding (by Ben Nagy).
+
+ https://github.com/bnagy/gapstone
+
+- Crabstone: Ruby binding (by Ben Nagy).
+
+ https://github.com/bnagy/crabstone
+
+- Capstone-vala: Vala binding (by Pancake).
+
+ https://github.com/radare/capstone-vala
+
+- C# binding (by Matt Graeber).
+
+ https://github.com/mattifestation/capstone
+
+- NodeJS binding (by Jason Oster).
+
+ https://github.com/parasyte/node-capstone
diff --git a/bindings/python/test_detail.py b/bindings/python/test_detail.py
index 03a4dd3..8014231 100755
--- a/bindings/python/test_detail.py
+++ b/bindings/python/test_detail.py
@@ -41,32 +41,32 @@
)
+def print_detail(insn):
+ # "data" instruction generated by SKIPDATA option has no detail
+ if insn.id == 0:
+ return
+
+ if len(insn.regs_read) > 0:
+ print("\tImplicit registers read: ", end=''),
+ for m in insn.regs_read:
+ print("%s " % insn.reg_name(m), end=''),
+ print()
+
+ if len(insn.regs_write) > 0:
+ print("\tImplicit registers modified: ", end=''),
+ for m in insn.regs_write:
+ print("%s " % insn.reg_name(m), end=''),
+ print()
+
+ if len(insn.groups) > 0:
+ print("\tThis instruction belongs to groups:", end=''),
+ for m in insn.groups:
+ print("%u" % m, end=''),
+ print()
+
+
# ## Test class Cs
def test_class():
- def print_detail(insn):
- # "data" instruction generated by SKIPDATA option has no detail
- if insn.id == 0:
- return
-
- if len(insn.regs_read) > 0:
- print("\tImplicit registers read: ", end=''),
- for m in insn.regs_read:
- print("%s " % insn.reg_name(m), end=''),
- print()
-
- if len(insn.regs_write) > 0:
- print("\tImplicit registers modified: ", end=''),
- for m in insn.regs_write:
- print("%s " % insn.reg_name(m), end=''),
- print()
-
- if len(insn.groups) > 0:
- print("\tThis instruction belongs to groups:", end=''),
- for m in insn.groups:
- print("%u" % m, end=''),
- print()
-
-
for (arch, mode, code, comment, syntax) in all_tests:
print('*' * 40)
print("Platform: %s" % comment)
diff --git a/contrib/windows_kernel/libc.cpp b/contrib/windows_kernel/libc.cpp
index 7c98849..101b26a 100644
--- a/contrib/windows_kernel/libc.cpp
+++ b/contrib/windows_kernel/libc.cpp
@@ -129,6 +129,6 @@
const char *format,
va_list argptr
)
-{
- return static_cast<int>(DbgPrint(format, argptr));
+{
+ return vsprintf_s(buffer, count, format, argptr);
}
diff --git a/include/capstone.h b/include/capstone.h
index 9ec8bce..33288c2 100644
--- a/include/capstone.h
+++ b/include/capstone.h
@@ -468,7 +468,7 @@
int cs_op_count(csh handle, cs_insn *insn, unsigned int op_type);
/*
- Retrieve the position of operand of given type in arch.op_info[] array.
+ Retrieve the position of operand of given type in <arch>.operands[] array.
Later, the operand can be accessed using the returned position.
Find the operand type in header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...)
@@ -480,7 +480,7 @@
@position: position of the operand to be found. This must be in the range
[1, cs_op_count(handle, insn, op_type)]
- @return: index of operand of given type @op_type in arch.op_info[] array
+ @return: index of operand of given type @op_type in <arch>.operands[] array
in instruction @insn, or -1 on failure.
*/
int cs_op_index(csh handle, cs_insn *insn, unsigned int op_type,