about summary refs log tree commit diff stats
path: root/miasm2
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2014-09-19 10:43:32 +0200
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2014-09-19 10:43:32 +0200
commit3674bace8dbc185aefca1b4fa85983adfe73956b (patch)
tree3868dca81348cc0ef76b024d2d151293e9a911d9 /miasm2
parent3f11ce8a64d4dcc37587c4750ae5381a808695ef (diff)
downloadmiasm-3674bace8dbc185aefca1b4fa85983adfe73956b.tar.gz
miasm-3674bace8dbc185aefca1b4fa85983adfe73956b.zip
merge
Diffstat (limited to '')
-rw-r--r--miasm2/arch/mips32/arch.py1
-rw-r--r--miasm2/arch/mips32/sem.py6
-rw-r--r--miasm2/arch/x86/sem.py27
3 files changed, 14 insertions, 20 deletions
diff --git a/miasm2/arch/mips32/arch.py b/miasm2/arch/mips32/arch.py
index 8a49c4f8..b3bbc3ff 100644
--- a/miasm2/arch/mips32/arch.py
+++ b/miasm2/arch/mips32/arch.py
@@ -688,6 +688,7 @@ mips32op("ext",     [bs('011111'), rs, rt, esize, epos, bs('000000')], [rt, rs,
 mips32op("ins",     [bs('011111'), rs, rt, eposh, epos, bs('000100')], [rt, rs, epos, eposh])
 
 mips32op("seb",     [bs('011111'), bs('00000'), rt, rd, bs('10000'), bs('100000')], [rd, rt])
+mips32op("seh",     [bs('011111'), bs('00000'), rt, rd, bs('11000'), bs('100000')], [rd, rt])
 mips32op("wsbh",    [bs('011111'), bs('00000'), rt, rd, bs('00010'), bs('100000')], [rd, rt])
 
 mips32op("di",      [bs('010000'), bs('01011'), rt, bs('01100'), bs('00000'), bs('0'), bs('00'), bs('000')])
diff --git a/miasm2/arch/mips32/sem.py b/miasm2/arch/mips32/sem.py
index e83d9b48..365444d7 100644
--- a/miasm2/arch/mips32/sem.py
+++ b/miasm2/arch/mips32/sem.py
@@ -225,6 +225,11 @@ def seb(ir, instr, a, b):
     e.append(ExprAff(a, b[:8].signExtend(32)))
     return e, []
 
+def seh(ir, instr, a, b):
+    e = []
+    e.append(ExprAff(a, b[:16].signExtend(32)))
+    return e, []
+
 def bltz(ir, instr, a, b):
     e = []
     n = ExprId(ir.get_next_break_label(instr))
@@ -475,6 +480,7 @@ mnemo_func = {
     "xori" : l_xor,
     "xor" : l_xor,
     "seb" : seb,
+    "seh" : seh,
     "bltz" : bltz,
     "blez" : blez,
     "wsbh" : wsbh,
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py
index c304def6..46302de3 100644
--- a/miasm2/arch/x86/sem.py
+++ b/miasm2/arch/x86/sem.py
@@ -1340,10 +1340,10 @@ def loop(ir, instr, dst):
 
     n = ExprId(ir.get_next_label(instr), instr.mode)
     c = myecx - ExprInt_from(myecx, 1)
+    dst_o = ExprCond(c, dst, n).zeroExtend(instr.mode)
     e.append(ExprAff(myecx, c))
-    e.append(ExprAff(meip, ExprCond(c, dst, n).zeroExtend(instr.mode)))
-    e.append(ExprAff(ir.IRDst, ExprCond(myecx, dst, n).zeroExtend(instr.mode)))
-    #dst_o = ExprCond(myecx, dst, n).zeroExtend(instr.mode)
+    e.append(ExprAff(meip, dst_o))
+    e.append(ExprAff(ir.IRDst, dst_o))
     return e, []
 
 
@@ -1362,15 +1362,9 @@ def loopne(ir, instr, dst):
     c &= zf ^ ExprInt1(1)
 
     e.append(ExprAff(myecx, myecx - ExprInt_from(myecx, 1)))
-    e.append(ExprAff(meip, ExprCond(c, dst, n).zeroExtend(instr.mode)))
-
-    # for dst, ecx has been modified!
-    c = ExprCond(mRCX[instr.mode][:s],
-                 ExprInt1(1),
-                 ExprInt1(0))
-    c &= zf ^ ExprInt1(1)
-    #dst_o = ExprCond(c, dst, n).zeroExtend(instr.mode)
-    e.append(ExprAff(ir.IRDst, ExprCond(c, dst, n).zeroExtend(instr.mode)))
+    dst_o = ExprCond(c, dst, n).zeroExtend(instr.mode)
+    e.append(ExprAff(meip, dst_o))
+    e.append(ExprAff(ir.IRDst, dst_o))
     return e, []
 
 
@@ -1389,14 +1383,7 @@ def loope(ir, instr, dst):
     e.append(ExprAff(myecx, myecx - ExprInt_from(myecx, 1)))
     dst_o = ExprCond(c, dst, n).zeroExtend(instr.mode)
     e.append(ExprAff(meip, dst_o))
-
-    # for dst, ecx has been modified!
-    c = ExprCond(mRCX[instr.mode][:s],
-                 ExprInt1(1),
-                 ExprInt1(0))
-    c &= zf
-    #dst_o = ExprCond(c, dst, n).zeroExtend(instr.mode)
-    e.append(ExprAff(ir.IRDst, ExprCond(c, dst, n).zeroExtend(instr.mode)))
+    e.append(ExprAff(ir.IRDst, dst_o))
     return e, []