about summary refs log tree commit diff stats
path: root/miasm2/arch/mips32
diff options
context:
space:
mode:
Diffstat (limited to 'miasm2/arch/mips32')
-rw-r--r--miasm2/arch/mips32/arch.py2
-rw-r--r--miasm2/arch/mips32/ira.py2
-rw-r--r--miasm2/arch/mips32/sem.py36
3 files changed, 39 insertions, 1 deletions
diff --git a/miasm2/arch/mips32/arch.py b/miasm2/arch/mips32/arch.py
index 19f8b26f..b3bbc3ff 100644
--- a/miasm2/arch/mips32/arch.py
+++ b/miasm2/arch/mips32/arch.py
@@ -688,9 +688,11 @@ 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')])
+mips32op("ei",      [bs('010000'), bs('01011'), rt, bs('01100'), bs('00000'), bs('1'), bs('00'), bs('000')])
 
 
 mips32op("tlbp",    [bs('010000'), bs('1'), bs('0'*19), bs('001000')])
diff --git a/miasm2/arch/mips32/ira.py b/miasm2/arch/mips32/ira.py
index bc9e2439..cb084411 100644
--- a/miasm2/arch/mips32/ira.py
+++ b/miasm2/arch/mips32/ira.py
@@ -55,7 +55,7 @@ class ir_a_mips32(ir_mips32, ira):
             lbl = bloc.get_next()
             new_lbl = self.gen_label()
             irs = self.call_effects(pc_val)
-            irs.append([ExprAff(IRDst, ExprId(lbl, size=self.pc.size))])
+            irs.append([ExprAff(self.IRDst, ExprId(lbl, size=self.pc.size))])
             nbloc = irbloc(new_lbl, irs)
             nbloc.lines = [l]
             self.blocs[new_lbl] = nbloc
diff --git a/miasm2/arch/mips32/sem.py b/miasm2/arch/mips32/sem.py
index b513a481..365444d7 100644
--- a/miasm2/arch/mips32/sem.py
+++ b/miasm2/arch/mips32/sem.py
@@ -60,6 +60,13 @@ def lhu(ir, instr, a, b):
     e.append(ExprAff(a, b.zeroExtend(32)))
     return e, []
 
+
+def lb(ir, instr, a, b):
+    e = []
+    b = ExprMem(b.arg, 8)
+    e.append(ExprAff(a, b.signExtend(32)))
+    return e, []
+
 def beq(ir, instr, a, b, c):
     e = []
     n = ExprId(ir.get_next_break_label(instr))
@@ -218,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))
@@ -394,6 +406,15 @@ def mult(ir, instr, a, b):
     e.append(ExprAff(R_HI, r[32:]))
     return e, []
 
+def multu(ir, instr, a, b):
+    e = []
+    size = a.size
+    r = a.zeroExtend(size * 2) * b.zeroExtend(size * 2)
+
+    e.append(ExprAff(R_LO, r[:32]))
+    e.append(ExprAff(R_HI, r[32:]))
+    return e, []
+
 def mfhi(ir, instr, a):
     e = []
     e.append(ExprAff(a, R_HI))
@@ -404,6 +425,14 @@ def mflo(ir, instr, a):
     e.append(ExprAff(a, R_LO))
     return e, []
 
+def di(ir, instr, a):
+    return [], []
+
+def ei(ir, instr, a):
+    return [], []
+
+def ehb(ir, instr, a):
+    return [], []
 
 mnemo_func = {
     "addiu": addiu,
@@ -418,6 +447,7 @@ mnemo_func = {
     "b" : l_b,
     "lbu" : lbu,
     "lhu" : lhu,
+    "lb" : lb,
     "beq" : beq,
     "bgez" : bgez,
     "bltz" : bltz,
@@ -450,6 +480,7 @@ mnemo_func = {
     "xori" : l_xor,
     "xor" : l_xor,
     "seb" : seb,
+    "seh" : seh,
     "bltz" : bltz,
     "blez" : blez,
     "wsbh" : wsbh,
@@ -476,10 +507,15 @@ mnemo_func = {
     "bc1f" : bc1f,
     "cvt.d.w":cvt_d_w,
     "mult" : mult,
+    "multu" : multu,
 
     "mfhi" : mfhi,
     "mflo" : mflo,
 
+    "di" : di,
+    "ei" : ei,
+    "ehb" : ehb,
+
     }
 
 def get_mnemo_expr(ir, instr, *args):