about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPierre LALET <pierre.lalet@cea.fr>2015-02-27 22:06:18 +0100
committerPierre LALET <pierre.lalet@cea.fr>2015-02-27 22:06:18 +0100
commitfc4c63c8287604bf4f626e1a4d63ea23d6972a19 (patch)
tree1d64181a457212e4aabb0adc05b9470b75fd3b34
parente1ba1dc1c56ed317c47042502a6556fd4c81ce51 (diff)
downloadmiasm-fc4c63c8287604bf4f626e1a4d63ea23d6972a19.tar.gz
miasm-fc4c63c8287604bf4f626e1a4d63ea23d6972a19.zip
msp430 semantic: fix carry and overflow flags for cmp.* mnemonics
Thanks serpilliere & kamoul0x
-rw-r--r--miasm2/arch/msp430/sem.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/miasm2/arch/msp430/sem.py b/miasm2/arch/msp430/sem.py
index cec8f36f..a6563ad5 100644
--- a/miasm2/arch/msp430/sem.py
+++ b/miasm2/arch/msp430/sem.py
@@ -244,8 +244,8 @@ def cmp_w(ir, instr, a, b):
     e, a, b = mng_autoinc(a, b, 16)
     c = b - a
     e += update_flag_zn_r(c)
-    e += update_flag_sub_cf(a, b, c)
-    e += update_flag_sub_of(a, b, c)
+    e += update_flag_sub_cf(b, a, c)
+    e += update_flag_sub_of(b, a, c)
     return e, []
 
 
@@ -253,8 +253,8 @@ def cmp_b(ir, instr, a, b):
     e, a, b = mng_autoinc(a, b, 8)
     c = b[:8] - a[:8]
     e += update_flag_zn_r(c)
-    e += update_flag_sub_cf(a[:8], b[:8], c)
-    e += update_flag_sub_of(a[:8], b[:8], c)
+    e += update_flag_sub_cf(b[:8], a[:8], c)
+    e += update_flag_sub_of(b[:8], a[:8], c)
     return e, []