about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorserpilliere <devnull@localhost>2012-11-28 16:17:00 +0100
committerserpilliere <devnull@localhost>2012-11-28 16:17:00 +0100
commit6fd48777a927670ab255b561226c3224b8aeba8c (patch)
treeaace33490ff6f5ad80529e00a4fc7da2d402e9ee
parent6752536bfbc2ff260fd6ccc1176bc3a83983123e (diff)
downloadmiasm-6fd48777a927670ab255b561226c3224b8aeba8c.tar.gz
miasm-6fd48777a927670ab255b561226c3224b8aeba8c.zip
ia32_arch: fix special mnemo args (louis granboulan)
Diffstat (limited to '')
-rw-r--r--miasm/arch/ia32_arch.py24
1 files changed, 20 insertions, 4 deletions
diff --git a/miasm/arch/ia32_arch.py b/miasm/arch/ia32_arch.py
index 83c7e612..ee0f7ca6 100644
--- a/miasm/arch/ia32_arch.py
+++ b/miasm/arch/ia32_arch.py
@@ -1784,6 +1784,26 @@ class x86_mn:
         for a in args:
             if x86_afs.segm in a:
                 prefix.append(x86_afs.reg_sg.index(a[x86_afs.segm]))
+
+        # special case ommiting 1 as argument
+        if len(args) == 1 and name in ["sal", "sar", "shl", "shr"]:
+            args.append("1")
+        # special case when the first argument should be omitted
+        if len(args) == 2 and name in ["fcomi", "fcomip", "fucomi", "fucomip"]:
+            args[0:1] = []
+        # special case when the second argument should be omitted
+        if len(args) == 2 and name in ["fdivp"]:
+            args[1:2] = []
+        # special case when the argument should be omitted
+        if len(args) == 1 and name in [
+                "stosb", "lodsb", "scasb",
+                "stosd", "lodsd", "scasd",
+                ]:
+            args[0:2] = []
+        # special case when both arguments should be omitted
+        if len(args) == 2 and name in [ "movsb", "movsd", "cmpsb", "cmpsd", ]:
+            args[0:2] = []
+
         return prefix, name, args
 
     @classmethod
@@ -1799,10 +1819,6 @@ class x86_mn:
         log.debug("name: %s"%name)
         log.debug("args: %s"%str(args))
 
-        # special case ommiting 1 as argument
-        if len(args) == 1 and name in ["sal", "sar", "shl", "shr"]:
-            args.append("1")
-
         args_eval = []
         for a in args:
             args_eval.append(x86_mn.parse_address(a))