diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2014-10-10 17:39:52 +0200 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2014-10-10 17:39:52 +0200 |
| commit | fa5b335bcc2ac2bc4b2abe63c53b427e9deb99d7 (patch) | |
| tree | 2284517a31b60a9bc81498b7768cee8f230e12c4 /miasm2/arch/x86 | |
| parent | e5ad0b4553329263240efeb7e7b0563d284355a8 (diff) | |
| download | miasm-fa5b335bcc2ac2bc4b2abe63c53b427e9deb99d7.tar.gz miasm-fa5b335bcc2ac2bc4b2abe63c53b427e9deb99d7.zip | |
x86 sem: fix 16bits push/pop
Diffstat (limited to 'miasm2/arch/x86')
| -rw-r--r-- | miasm2/arch/x86/sem.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py index b192ee2c..2bad64fc 100644 --- a/miasm2/arch/x86/sem.py +++ b/miasm2/arch/x86/sem.py @@ -603,13 +603,15 @@ def push(ir, instr, a): opmode, admode = s, instr.v_admode() # special case segment regs if a in [ES, CS, SS, DS, FS, GS]: - pass + off = admode + else: + off = a.size if not s in [16, 32, 64]: raise ValueError('bad size stacker!') if isinstance(a, ExprInt): a = ExprInt_fromsize(s, a.arg) - c = mRSP[instr.mode][:s] - ExprInt_fromsize(s, s / 8) + c = mRSP[instr.mode][:s] - ExprInt_fromsize(s, off / 8) e.append(ExprAff(mRSP[instr.mode][:s], c)) # we sub vopmode to stack, but mem access is arg size wide if ir.do_stk_segm: @@ -625,10 +627,12 @@ def pop(ir, instr, a): opmode, admode = s, instr.v_admode() # special case segment regs if a in [ES, CS, SS, DS, FS, GS]: - s = admode + off = admode + else: + off = a.size if not s in [16, 32, 64]: raise ValueError('bad size stacker!') - new_esp = mRSP[instr.mode][:s] + ExprInt_fromsize(s, s / 8) + new_esp = mRSP[instr.mode][:s] + ExprInt_fromsize(s, off / 8) e.append(ExprAff(mRSP[instr.mode][:s], new_esp)) # XXX FIX XXX for pop [esp] if isinstance(a, ExprMem): |