diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2016-01-29 11:28:17 +0100 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2016-01-30 12:02:37 +0100 |
| commit | 9ef7ea583ab1e042565465e3abbdd66482ebf63d (patch) | |
| tree | db25552460fd4ea194167842cc7b8e85e9d9c27d | |
| parent | a9ad6d3a1fdc0084aec37e27e472ceaee7f49ddd (diff) | |
| download | miasm-9ef7ea583ab1e042565465e3abbdd66482ebf63d.tar.gz miasm-9ef7ea583ab1e042565465e3abbdd66482ebf63d.zip | |
X86/sem: fix mov[hl]
| -rw-r--r-- | miasm2/arch/x86/sem.py | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py index c1caa905..5c670684 100644 --- a/miasm2/arch/x86/sem.py +++ b/miasm2/arch/x86/sem.py @@ -273,13 +273,10 @@ def mov(ir, instr, a, b): def movq(ir, instr, dst, src): - if dst.size == src.size: - e = [m2_expr.ExprAff(dst, src)] - elif dst.size > src.size: - e = [m2_expr.ExprAff(dst, src.zeroExtend(dst.size))] - else: - e = [m2_expr.ExprAff(dst, src[:dst.size])] - return e, [] + src_final = (src.zeroExtend(dst.size) + if dst.size >= src.size else + src[:dst.size]) + return [m2_expr.ExprAff(dst, src_final)], [] @sbuild.parse @@ -3921,16 +3918,27 @@ def movlps(ir, instr, a, b): def movhpd(ir, instr, a, b): e = [] - e.append(m2_expr.ExprAff(a[64:128], b[:64])) + if b.size == 64: + e.append(m2_expr.ExprAff(a[64:128], b)) + elif a.size == 64: + e.append(m2_expr.ExprAff(a, b[64:128])) + else: + raise RuntimeError("bad encoding!") return e, [] -def movhps(ir, instr, a, b): +def movlhps(ir, instr, a, b): e = [] e.append(m2_expr.ExprAff(a[64:128], b[:64])) return e, [] +def movhlps(ir, instr, a, b): + e = [] + e.append(m2_expr.ExprAff(a[:64], b[64:128])) + return e, [] + + def movdq2q(ir, instr, a, b): e = [] e.append(m2_expr.ExprAff(a, b[:64])) @@ -4450,9 +4458,9 @@ mnemo_func = {'mov': mov, "movlpd": movlpd, "movlps": movlps, "movhpd": movhpd, - "movhps": movhps, - "movlhps": movhps, - "movhlps": movlps, + "movhps": movhpd, + "movlhps": movlhps, + "movhlps": movhlps, "movdq2q": movdq2q, "sqrtpd": sqrtpd, |