about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorserpilliere <devnull@localhost>2012-11-28 15:24:21 +0100
committerserpilliere <devnull@localhost>2012-11-28 15:24:21 +0100
commit3aaf5f7450354c54964036392cd7bd4bc37e8225 (patch)
treea390513736e75096bc8d019949891d6fe70ba47b
parent93919d6f2e78617205dd1f5567adb6d4ab98094b (diff)
downloadmiasm-3aaf5f7450354c54964036392cd7bd4bc37e8225.tar.gz
miasm-3aaf5f7450354c54964036392cd7bd4bc37e8225.zip
ia32_arch: deal with homonym (louis granboulan)
Diffstat (limited to '')
-rw-r--r--miasm/arch/ia32_arch.py51
1 files changed, 26 insertions, 25 deletions
diff --git a/miasm/arch/ia32_arch.py b/miasm/arch/ia32_arch.py
index 0b73dff3..83c7e612 100644
--- a/miasm/arch/ia32_arch.py
+++ b/miasm/arch/ia32_arch.py
@@ -95,22 +95,22 @@ d7 = 7<<3
 reg = "reg"
 noafs = "noafs"
 cond = "cond"
-cond_list = ["o",
-             "no",
-             "b",
-             "ae",
-             "e",
-             "nz",
-             "be",
-             "a",
-             "s",
-             "ns",
-             "p",
-             "np",
-             "l",#             "nge",
-             "ge",
-             "le",
-             "g"
+cond_list = [["o"],
+             ["no"],
+             ["nae","c","b"],
+             ["nb","nc","ae"],
+             ["z","e"],
+             ["ne","nz"],
+             ["be"],
+             ["a"],
+             ["s"],
+             ["ns"],
+             ["pe","p"],
+             ["po","np"],
+             ["nge","l"],
+             ["nl","ge"],
+             ["ng","le"],
+             ["nle","g"],
              ]
 no_rm = []
 rmr = "rmr"
@@ -609,15 +609,16 @@ class x86allmncs:
                     opc_tmp = opc[:]
                     i_k = k&(mask_cond^0xFF)
                     opc_tmp[-1]|=i_k
-                    mnemo = mnemonic(name+cond_list[i_k], opc_tmp, afs, rm, n_m, modif_desc, sem)
-                    if insert_tab[k]!=None and not name in unsanity_mnemo:
-                        raise ValueError("sanity check fail in mnemo affect %s"%str(insert_tab[k]))
-                    insert_tab[k] = mnemo
-                    #fast mnemo_lookup
-                    if not mnemo.name in self.mnemo_lookup:
-                        self.mnemo_lookup[mnemo.name] = [mnemo]
-                    elif not mnemo in self.mnemo_lookup[mnemo.name]:
-                        self.mnemo_lookup[mnemo.name].append(mnemo)
+                    for cond_suffix in cond_list[i_k]:
+                        mnemo = mnemonic(name+cond_suffix, opc_tmp, afs, rm, n_m, modif_desc, sem)
+                        #if insert_tab[k]!=None and not name in unsanity_mnemo:
+                        #    raise ValueError("sanity check fail in mnemo affect %s"%str(insert_tab[k]))
+                        insert_tab[k] = mnemo
+                        #fast mnemo_lookup
+                        if not mnemo.name in self.mnemo_lookup:
+                            self.mnemo_lookup[mnemo.name] = [mnemo]
+                        elif not mnemo in self.mnemo_lookup[mnemo.name]:
+                            self.mnemo_lookup[mnemo.name].append(mnemo)
 
             else:
                 mnemo = mnemonic(name, opc, afs, rm, n_m, modif_desc, sem)