about summary refs log tree commit diff stats
path: root/miasm2/core/parse_asm.py
diff options
context:
space:
mode:
authorserpilliere <serpilliere@users.noreply.github.com>2016-01-13 14:14:51 +0100
committerserpilliere <serpilliere@users.noreply.github.com>2016-01-13 14:14:51 +0100
commit4c9094900f28a569bab5b0d6fc3343e418eb8569 (patch)
tree85d334f59d736db409d38e80c49e8a19e50525fe /miasm2/core/parse_asm.py
parent8dbf8b2747bed3257bb8db5f1c01cd08a846c3f0 (diff)
parentcd243102ed09dc8e61fba8d5e4e4ac28c78023c2 (diff)
downloadmiasm-4c9094900f28a569bab5b0d6fc3343e418eb8569.tar.gz
miasm-4c9094900f28a569bab5b0d6fc3343e418eb8569.zip
Merge pull request #302 from commial/refactor-asmlabel
Refactor asmlabel
Diffstat (limited to 'miasm2/core/parse_asm.py')
-rw-r--r--miasm2/core/parse_asm.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/miasm2/core/parse_asm.py b/miasm2/core/parse_asm.py
index 646ad445..e55a9af8 100644
--- a/miasm2/core/parse_asm.py
+++ b/miasm2/core/parse_asm.py
@@ -238,10 +238,9 @@ def parse_txt(mnemo, attrib, txt, symbol_pool=None):
     delayslot = 0
     while i < len(lines):
         if delayslot:
+            delayslot -= 1
             if delayslot == 0:
                 state = STATE_NO_BLOC
-            else:
-                delayslot -= 1
         line = lines[i]
         # no current block
         if state == STATE_NO_BLOC:
@@ -306,18 +305,20 @@ def parse_txt(mnemo, attrib, txt, symbol_pool=None):
                             continue
                         if dst in mnemo.regs.all_regs_ids:
                             continue
-                        cur_block.addto(asmbloc.asm_constraint(dst, C_TO))
+                        cur_block.addto(asmbloc.asm_constraint(dst.name, C_TO))
 
                 if not line.splitflow():
                     block_to_nlink = None
 
-                delayslot = line.delayslot
-                if delayslot == 0:
-                    state = STATE_NO_BLOC
+                delayslot = line.delayslot + 1
             else:
                 raise RuntimeError("unknown class %s" % line.__class__)
         i += 1
 
     for block in blocks:
+        # Fix multiple constraints
+        block.fix_constraints()
+
+        # Log block
         asmbloc.log_asmbloc.info(block)
     return blocks, symbol_pool