From 6f85aed4b7e2954715ae284921834ad6ca213da3 Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Thu, 19 Dec 2013 12:41:32 +0800 Subject: [PATCH 1/3] arm: add comments to arm.h for coprocessor register types --- include/arm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/arm.h b/include/arm.h index 7a81f906..b2d770f5 100644 --- a/include/arm.h +++ b/include/arm.h @@ -50,8 +50,8 @@ typedef enum arm_cc { typedef enum arm_op_type { ARM_OP_INVALID = 0, // Uninitialized. ARM_OP_REG, // Register operand. - ARM_OP_CIMM, // C-Immediate - ARM_OP_PIMM, // P-Immediate + ARM_OP_CIMM, // C-Immediate (coprocessor registers) + ARM_OP_PIMM, // P-Immediate (coprocessor registers) ARM_OP_IMM, // Immediate operand. ARM_OP_FP, // Floating-Point immediate operand. ARM_OP_MEM, // Memory operand From 630a86bcd8cda9df000fb66715078d76325590d0 Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Fri, 20 Dec 2013 17:48:27 +0800 Subject: [PATCH 2/3] python: cs_disasm_quick() doesnt create CsInsn array on return, and makes reference to non-existent self. bug reported by Mario Vilas --- bindings/python/capstone/capstone.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/python/capstone/capstone.py b/bindings/python/capstone/capstone.py index 7b2f67d7..f0fb822c 100644 --- a/bindings/python/capstone/capstone.py +++ b/bindings/python/capstone/capstone.py @@ -213,11 +213,11 @@ def cs_disasm_quick(arch, mode, code, offset, count = 0): res = _cs.cs_disasm_dyn(csh, code, len(code), offset, count, ctypes.byref(all_insn)) if res > 0: for i in xrange(res): - insns.append(all_insn[i]) + insns.append(CsInsn(self.csh, all_insn[i], self.arch)) _cs.cs_free(all_insn) else: - status = _cs.cs_errno(self.csh) + status = _cs.cs_errno(csh) if status != CS_ERR_OK: raise CsError(status) From a1818520dfb37596cc5a3f19f3e04412c4c66dca Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Fri, 20 Dec 2013 18:55:03 +0800 Subject: [PATCH 3/3] python: correct the last commit to fix cs_disasm_quick() --- bindings/python/capstone/capstone.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/python/capstone/capstone.py b/bindings/python/capstone/capstone.py index f0fb822c..6b8d6f02 100644 --- a/bindings/python/capstone/capstone.py +++ b/bindings/python/capstone/capstone.py @@ -213,7 +213,7 @@ def cs_disasm_quick(arch, mode, code, offset, count = 0): res = _cs.cs_disasm_dyn(csh, code, len(code), offset, count, ctypes.byref(all_insn)) if res > 0: for i in xrange(res): - insns.append(CsInsn(self.csh, all_insn[i], self.arch)) + insns.append(CsInsn(csh, all_insn[i], arch)) _cs.cs_free(all_insn) else: