about summary refs log tree commit diff stats
path: root/miasm2/arch/msp430/arch.py
diff options
context:
space:
mode:
authorCamille Mougey <commial@gmail.com>2015-01-26 17:03:00 +0100
committerCamille Mougey <commial@gmail.com>2015-01-26 17:03:00 +0100
commit9ce67b459cc8946c81181ab22030786450b8b0c5 (patch)
treeaf11ee8fbaff14fce0e7ece814b867bb7db0af9d /miasm2/arch/msp430/arch.py
parentb87f775c1a6a5c78c62beee925eaba6dc337577e (diff)
parent49300708f13622595c3cc147a03b6c7848da195d (diff)
downloadmiasm-9ce67b459cc8946c81181ab22030786450b8b0c5.tar.gz
miasm-9ce67b459cc8946c81181ab22030786450b8b0c5.zip
Merge pull request #48 from serpilliere/arm_fix_flow
Arm: fix execflow code
Diffstat (limited to 'miasm2/arch/msp430/arch.py')
-rw-r--r--miasm2/arch/msp430/arch.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/miasm2/arch/msp430/arch.py b/miasm2/arch/msp430/arch.py
index 34993ebc..dff91e7b 100644
--- a/miasm2/arch/msp430/arch.py
+++ b/miasm2/arch/msp430/arch.py
@@ -16,6 +16,9 @@ console_handler.setFormatter(logging.Formatter("%(levelname)-5s: %(message)s"))
 log.addHandler(console_handler)
 log.setLevel(logging.DEBUG)
 
+conditional_branch = ['jnz', 'jz', 'jnc', 'jc',
+                      'jn', 'jge', 'jl']
+unconditional_branch = ['jmp']
 
 def deref2expr_nooff(s, l, t):
     t = t[0]
@@ -152,7 +155,7 @@ class instruction_msp430(instruction):
         self.args[0] = s
 
     def breakflow(self):
-        if self.name.startswith('j'):
+        if self.name in conditional_branch + unconditional_branch:
             return True
         if self.name.startswith('ret'):
             return True
@@ -163,10 +166,10 @@ class instruction_msp430(instruction):
         return self.name in ['call']
 
     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
         return self.name in ['call']
 
     def setdstflow(self, a):