about summary refs log tree commit diff stats
path: root/miasm2/core/parse_asm.py
diff options
context:
space:
mode:
authorAjax <commial@gmail.com>2016-01-11 15:53:46 +0100
committerAjax <commial@gmail.com>2016-01-11 15:59:25 +0100
commit6b09332775857805741be7ef6b1fc98e189f4d5b (patch)
tree9b41c5d411e1f39eb3d02082852fd668de3989f7 /miasm2/core/parse_asm.py
parent902f1968e834ae4f4719a17fe088c5258dd0e4e9 (diff)
downloadfocaccia-miasm-6b09332775857805741be7ef6b1fc98e189f4d5b.tar.gz
focaccia-miasm-6b09332775857805741be7ef6b1fc98e189f4d5b.zip
Mips32: fix delayslot (creds @serpilliere)
Diffstat (limited to 'miasm2/core/parse_asm.py')
-rw-r--r--miasm2/core/parse_asm.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/miasm2/core/parse_asm.py b/miasm2/core/parse_asm.py
index 646ad445..840b88db 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:
@@ -311,9 +310,7 @@ def parse_txt(mnemo, attrib, txt, symbol_pool=None):
                 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