about summary refs log tree commit diff stats
path: root/miasm2/jitter/jitcore_python.py
diff options
context:
space:
mode:
Diffstat (limited to 'miasm2/jitter/jitcore_python.py')
-rw-r--r--miasm2/jitter/jitcore_python.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/miasm2/jitter/jitcore_python.py b/miasm2/jitter/jitcore_python.py
index 7dc0b710..90c8bace 100644
--- a/miasm2/jitter/jitcore_python.py
+++ b/miasm2/jitter/jitcore_python.py
@@ -114,6 +114,9 @@ class JitCore_Python(jitcore.JitCore):
             cur_label = label
             loop = True
 
+            # Required to detect new instructions
+            offsets_jitted = set()
+
             # Get exec engine
             exec_engine = self.symbexec
 
@@ -135,12 +138,17 @@ class JitCore_Python(jitcore.JitCore):
 
                 # Execute current ir bloc
                 for ir, line in zip(irb.irs, irb.lines):
-                    # Check for memory exception
-                    if (vmmngr.vm_get_exception() != 0):
-                        update_cpu_from_engine(cpu, exec_engine)
-                        return line.offset
 
-                    # Eval current instruction
+                    # For each new instruction (in assembly)
+                    if line.offset not in offsets_jitted:
+                        offsets_jitted.add(line.offset)
+
+                        # Check for memory exception
+                        if (vmmngr.vm_get_exception() != 0):
+                            update_cpu_from_engine(cpu, exec_engine)
+                            return line.offset
+
+                    # Eval current instruction (in IR)
                     exec_engine.eval_ir(ir)
 
                     # Check for memory exception which do not update PC