about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2015-01-26 16:52:13 +0100
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2015-01-26 16:52:13 +0100
commit49300708f13622595c3cc147a03b6c7848da195d (patch)
treeaf11ee8fbaff14fce0e7ece814b867bb7db0af9d
parent97df9f649b0bfc59aebc622711aedb3afa4eefad (diff)
downloadmiasm-49300708f13622595c3cc147a03b6c7848da195d.tar.gz
miasm-49300708f13622595c3cc147a03b6c7848da195d.zip
X86: fix execflow code
Diffstat (limited to '')
-rw-r--r--miasm2/arch/x86/arch.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/miasm2/arch/x86/arch.py b/miasm2/arch/x86/arch.py
index 186cbd8b..85356468 100644
--- a/miasm2/arch/x86/arch.py
+++ b/miasm2/arch/x86/arch.py
@@ -16,6 +16,12 @@ console_handler.setFormatter(logging.Formatter("%(levelname)-5s: %(message)s"))
 log.addHandler(console_handler)
 log.setLevel(logging.WARN)
 
+conditional_branch = ["JO", "JNO", "JB", "JAE",
+                      "JZ", "JNZ", "JBE", "JA",
+                      "JS", "JNS", "JPE", "JNP",
+                      #"L", "NL", "NG", "G"]
+                      "JL", "JGE", "JLE", "JG"]
+unconditional_branch = ['JMP']
 
 f_isad = "AD"
 f_s08 = "S08"
@@ -465,7 +471,7 @@ class instruction_x86(instruction):
         return self.additional_info.v_admode
 
     def dstflow(self):
-        if self.name.startswith('J'):
+        if self.name in conditional_branch + unconditional_branch:
             return True
         if self.name.startswith('LOOP'):
             return True
@@ -491,7 +497,7 @@ class instruction_x86(instruction):
             return
 
     def breakflow(self):
-        if self.name.startswith('J'):
+        if self.name in conditional_branch + unconditional_branch:
             return True
         if self.name.startswith('LOOP'):
             return True
@@ -507,10 +513,10 @@ class instruction_x86(instruction):
         return self.name in ['CALL', 'HLT', 'IRET', 'ICEBP']
 
     def splitflow(self):
-        if self.name.startswith('JMP'):
-            return False
-        if self.name.startswith('J'):
+        if self.name in conditional_branch:
             return True
+        if self.name in unconditional_branch:
+            return False
         if self.name.startswith('LOOP'):
             return True
         if self.name.startswith('INT'):