about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorserpilliere <devnull@localhost>2012-04-02 19:08:33 +0200
committerserpilliere <devnull@localhost>2012-04-02 19:08:33 +0200
commitd62e9254ec2da26b35e343eef35314e62f05730b (patch)
tree45e52fe7fa7f07de4235a2c1df9d40c5512e4f6a
parent0dfd6d1331db05970e5a2028cebf765070245256 (diff)
downloadmiasm-d62e9254ec2da26b35e343eef35314e62f05730b.tar.gz
miasm-d62e9254ec2da26b35e343eef35314e62f05730b.zip
ia32_arch: add jmpf w/ea form
-rw-r--r--miasm/arch/ia32_arch.py14
-rw-r--r--miasm/arch/ia32_sem.py8
2 files changed, 21 insertions, 1 deletions
diff --git a/miasm/arch/ia32_arch.py b/miasm/arch/ia32_arch.py
index 9eb8ba0e..f1c920bd 100644
--- a/miasm/arch/ia32_arch.py
+++ b/miasm/arch/ia32_arch.py
@@ -161,7 +161,8 @@ unsanity_mnemo = ['nop', 'monitor', 'mwait', 'fadd', 'faddp', 'fiadd', 'fcmovb',
                   'fdiv', 'fdivr', 'fidivr', 'fdivrp', 'ficom', 'ficomp', 'fild', 'fist', 'fistp', 'fisttp',
                   'fld', 'fldcw', 'fld1', 'fldl2t', "fldl2e", "fldpi", "fldlg2", "fldln2", "fldz", 'fldenv', 'fmul', 'fimul', 'fmulp', 'fst', 'fstp', 'fnstcw', 'fnstenv', 'f2xm1',
                   'fnstsw', 'fsub', 'fsubr', 'fisubr', 'fsubrp', 'ftst', 'fucom', 'fucompp', 'fxam', 'fxtract', 'fyl2x', 'fyl2xp1', 'fsqrt', 'fsincos', 'fsin', 'fscale',
-                  'fcos', 'fdecstp', 'fnop', 'fpatan', 'fprem', 'fprem1', 'fptan', 'frndint', "shl", 'sal', 'sar', 'fabs']
+                  'fcos', 'fdecstp', 'fnop', 'fpatan', 'fprem', 'fprem1', 'fptan', 'frndint', "shl", 'sal', 'sar', 'fabs',
+                  "jmpff"]
 
 
 mask_drcrsg = {cr:0x100, dr:0x200, sg:0x400}
@@ -848,6 +849,7 @@ class x86allmncs:
         addop("jecxz", [0xE3],             noafs, [s08]         , {}                 ,{}                , {bkf:True,spf:True,dtf:True})
 
         addop("jmp",   [0xE9],             noafs, [ims]         , {w8:(0,1)}         ,{w8:False}        , {bkf:True,dtf:True}         )
+        addop("jmpf",   [0xEa],             noafs, [ims,u16]       ,{}                  ,{}        , {bkf:True,dtf:True}         )
         addop("jmp",   [0xFF],             d4   , no_rm         , {}                 ,{}                , {bkf:True,dtf:True}         )
         addop("jmpf",  [0xFF],             d5   , no_rm         , {}                 ,{}                , {bkf:True,dtf:True}         )
 
@@ -2266,6 +2268,16 @@ if __name__ == '__main__':
     test_out = []
     log.setLevel(logging.DEBUG)
 
+    instr = x86mnemo.dis('ea21060000'.replace(' ', '').decode('hex'),
+                         admode=x86_afs.u16,
+                         opmode=x86_afs.u16)
+    print instr
+    print instr.arg
+    print instr.l
+    print instr.opmode, instr.admode
+    fds
+
+
     instr = x86mnemo.dis('0fbe13'.replace(' ', '').decode('hex'),)
                          #admode=x86_afs.u16,
                          #opmode=x86_afs.u16)
diff --git a/miasm/arch/ia32_sem.py b/miasm/arch/ia32_sem.py
index 16d31dc9..23ff103f 100644
--- a/miasm/arch/ia32_sem.py
+++ b/miasm/arch/ia32_sem.py
@@ -1253,6 +1253,13 @@ def jmp(info, a):
     e.append(ExprAff(eip, a))
     return e
 
+def jmpf(info, a, seg):
+    e= []
+    e.append(ExprAff(eip, a))
+    e.append(ExprAff(cs, seg))
+    return e
+
+
 def jz(info, a, b):
     e= []
     e.append(ExprAff(eip, ExprCond(ExprOp('==', zf, ExprInt(uint32(1))), b, a)))
@@ -2091,6 +2098,7 @@ mnemo_func = {'mov': mov,
               'leave':leave,
               'enter':enter,
               'jmp':jmp,
+              'jmpf':jmpf,
               'jz':jz,
               'je':jz,
               'jnz':jnz,