about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--miasm2/arch/x86/sem.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py
index 1b3a13af..dd0d9e11 100644
--- a/miasm2/arch/x86/sem.py
+++ b/miasm2/arch/x86/sem.py
@@ -969,6 +969,29 @@ def call(ir, instr, dst):
     myesp = mRSP[instr.mode][:opmode]
     n = ExprId(ir.get_next_label(instr), instr.mode)
 
+
+    if (isinstance(dst, ExprOp) and dst.op == "segm"):
+        # call far
+        if instr.mode != 16:
+            raise NotImplementedError('add 32 bit support!')
+        segm = dst.args[0]
+        base = dst.args[1]
+        m1 = segm.zeroExtend(CS.size)
+        m2 = base.zeroExtend(meip.size)
+        e.append(ExprAff(CS, m1))
+        e.append(ExprAff(meip, m2))
+
+        c = myesp + ExprInt_fromsize(s, -s/8)
+        e.append(ExprAff(ExprMem(c, size=s).zeroExtend(s), CS.zeroExtend(s)))
+
+        c = myesp + ExprInt_fromsize(s, -2*s/8)
+        e.append(ExprAff(ExprMem(c, size=s).zeroExtend(s), meip.zeroExtend(s)))
+
+        c = myesp + ExprInt_fromsize(s, (-2*s) / 8)
+        e.append(ExprAff(myesp, c))
+        return meip, e, []
+
+
     c = myesp + ExprInt_fromsize(s, (-s / 8))
     e.append(ExprAff(myesp, c))
     if ir.do_stk_segm: