changeset 82:032495f8dd12

Split block of code into instructions and fix insn format info
author Thinker K.F. Li <thinker@codemud.net>
date Wed, 20 Jul 2011 20:36:51 +0800
parents 7adb8c3b3c44
children fd668c00e7e0
files paraspace/dalvik_opcodes.py
diffstat 1 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/paraspace/dalvik_opcodes.py	Wed Jul 20 01:55:48 2011 +0800
+++ b/paraspace/dalvik_opcodes.py	Wed Jul 20 20:36:51 2011 +0800
@@ -1053,7 +1053,7 @@
 'kFmt21t': 'v{0}, +{1:04x}',
 'kFmt21s': 'v{0}, #+{1:04x}',
 'kFmt21h': 'v{0}, #+{1:04x}00000[00000000]',
-'kFmt21c': 'v{0}, thing@{:04x}',
+'kFmt21c': 'v{0}, thing@{1:04x}',
 'kFmt23x': 'v{0}, v{1}, v{2}',
 'kFmt22b': 'v{0}, v{1}, #+{2:02x}',
 'kFmt22t': 'v{0}, v{1}, +{2:04x}',
@@ -1080,7 +1080,7 @@
 'kFmtUnknown': (),              # ''
 'kFmt10x': (),                  # ''
 'kFmt12x': (1, 1),              # 'vA, vB'
-'kFmt11n': (1, 2),              # 'vA, #+B'
+'kFmt11n': (1, 1),              # 'vA, #+B'
 'kFmt11x': (2,),                # 'vAA'
 'kFmt10t': (2,),                # '+AA'
 'kFmt20t': (4,),                # '+AAAA'
@@ -1242,6 +1242,20 @@
     return line
 
 
+## \brief Split a block of code into instructions.
+def split_blk_2_insns(insn_blk):
+    start = 0
+    while start < len(insn_blk):
+        opcode = ord(insn_blk[start])
+        width = opcode_widths[opcode]
+        stop = start + width * 2
+        inst = insn_blk[start:stop]
+        yield inst
+        start = stop
+        pass
+    pass
+
+
 del name
 del _names
 del _opcode