diff options
| author | serpilliere <devnull@localhost> | 2014-08-12 10:13:36 +0200 |
|---|---|---|
| committer | serpilliere <devnull@localhost> | 2014-08-12 10:13:36 +0200 |
| commit | 0b526f3725bfa78444c2f2d8f6167793de579029 (patch) | |
| tree | 998928f2e72a8d97e3c1626cb4b7fbb52aaefd3d | |
| parent | 0d40c0bcafa778cb99159dc26e39822602d3f363 (diff) | |
| download | miasm-0b526f3725bfa78444c2f2d8f6167793de579029.tar.gz miasm-0b526f3725bfa78444c2f2d8f6167793de579029.zip | |
x86: fix call far semantic
| -rw-r--r-- | miasm2/arch/x86/sem.py | 23 |
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: |