diff options
| author | Ajax <commial@gmail.com> | 2017-01-05 14:54:49 +0100 |
|---|---|---|
| committer | Ajax <commial@gmail.com> | 2017-01-05 14:55:45 +0100 |
| commit | 6b670aecbadb14cbe28bad9e987fbd5969d2ec63 (patch) | |
| tree | 0aeb18299450539af192263cf58b720a170561e9 | |
| parent | ff72136d4b3b7441195924a124350b30624b2768 (diff) | |
| download | miasm-6b670aecbadb14cbe28bad9e987fbd5969d2ec63.tar.gz miasm-6b670aecbadb14cbe28bad9e987fbd5969d2ec63.zip | |
x86 BT*: include shift inside addr computation (segm case)
| -rw-r--r-- | miasm2/arch/x86/sem.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py index 69a17684..ea5830e3 100644 --- a/miasm2/arch/x86/sem.py +++ b/miasm2/arch/x86/sem.py @@ -2908,13 +2908,20 @@ def bittest_get(a, b): b_mask = {16: 4, 32: 5, 64: 6} b_decal = {16: 1, 32: 3, 64: 7} ptr = a.arg + segm = a.is_op_segm() + if segm: + ptr = ptr.args[1] + off_bit = b.zeroExtend( a.size) & m2_expr.ExprInt((1 << b_mask[a.size]) - 1, a.size) off_byte = ((b.zeroExtend(ptr.size) >> m2_expr.ExprInt(3, ptr.size)) & m2_expr.ExprInt(((1 << a.size) - 1) ^ b_decal[a.size], ptr.size)) - d = m2_expr.ExprMem(ptr + off_byte, a.size) + addr = ptr + off_byte + if segm: + addr = m2_expr.ExprOp("segm", a.arg.args[0], addr) + d = m2_expr.ExprMem(addr, a.size) else: off_bit = m2_expr.ExprOp('&', b, m2_expr.ExprInt(a.size - 1, a.size)) d = a |