about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorserpilliere <devnull@localhost>2011-08-11 09:43:36 +0200
committerserpilliere <devnull@localhost>2011-08-11 09:43:36 +0200
commit528bae574473be0a06df56222c0fb2ca5a463db5 (patch)
treefbc50b0fe6abc62d80881fcc3509117b3b302963
parent309c208f80552f50eeaa9a7f2aa72cc9cc4b9573 (diff)
downloadmiasm-528bae574473be0a06df56222c0fb2ca5a463db5.tar.gz
miasm-528bae574473be0a06df56222c0fb2ca5a463db5.zip
fix disasm bug in ia32_arch
-rw-r--r--miasm/arch/ia32_arch.py26
1 files changed, 22 insertions, 4 deletions
diff --git a/miasm/arch/ia32_arch.py b/miasm/arch/ia32_arch.py
index 5cb2a3ec..8023e274 100644
--- a/miasm/arch/ia32_arch.py
+++ b/miasm/arch/ia32_arch.py
@@ -1221,6 +1221,18 @@ class x86allmncs:
         pm = self.db_mnemo[0x9c]
         self.pushfw_m = mnemonic(pm.name, pm.opc, pm.afs, pm.rm, pm.modifs, pm.modifs_orig, None)#, pm.sem)
         self.pushfw_m.name = "pushfw"
+
+        pm = self.find_mnemo("lodsd")[0]
+        self.lodsw_m = mnemonic(pm.name, pm.opc, pm.afs, pm.rm, pm.modifs, pm.modifs_orig, None)#, pm.sem)
+        self.lodsw_m.name = "lodsw"
+
+        pm = self.find_mnemo("stosd")[0]
+        self.stosw_m = mnemonic(pm.name, pm.opc, pm.afs, pm.rm, pm.modifs, pm.modifs_orig, None)#, pm.sem)
+        self.stosw_m.name = "stosw"
+
+        pm = self.find_mnemo("movsd")[0]
+        self.movsw_m = mnemonic(pm.name, pm.opc, pm.afs, pm.rm, pm.modifs, pm.modifs_orig, None)#, pm.sem)
+        self.movsw_m.name = "movsw"
         
     
 
@@ -1621,15 +1633,15 @@ class x86_mn:
             self.arg = mnemo_args
             self.prefix = read_prefix
 
-            #XXX hack
+            #XXX really need to include this in disasm
             if 0x66 in read_prefix and self.m.name == "pushfd":
                 self.m = x86mndb.pushfw_m
             if 0x66 in read_prefix and self.m.name == "lodsd":
-                self.m.name = "lodsw"
+                self.m = x86mndb.lodsw_m
             if 0x66 in read_prefix and self.m.name == "stosd":
-                self.m.name = "stosw"
+                self.m = x86mndb.stosw_m
             if 0x66 in read_prefix and self.m.name == "movsd":
-                self.m.name = "movsw"
+                self.m  = x86mndb.movsw_m
                 
             return True
 
@@ -2178,6 +2190,12 @@ if __name__ == '__main__':
     test_out = []
     log.setLevel(logging.DEBUG)
 
+    instr = x86mnemo.dis('66A5'.replace(' ', '').decode('hex'), admode=x86_afs.u32)
+    print instr
+    print instr.arg
+    print instr.l
+    fds
+
     instr = x86mnemo.dis('DB 28'.replace(' ', '').decode('hex'), admode=x86_afs.u32)
     print instr
     print instr.arg