diff options
Diffstat (limited to 'miasm2/expression')
| -rw-r--r-- | miasm2/expression/expression_helper.py | 2 | ||||
| -rw-r--r-- | miasm2/expression/simplifications.py | 5 | ||||
| -rw-r--r-- | miasm2/expression/simplifications_common.py | 4 |
3 files changed, 8 insertions, 3 deletions
diff --git a/miasm2/expression/expression_helper.py b/miasm2/expression/expression_helper.py index cd59730b..0a4dd3ca 100644 --- a/miasm2/expression/expression_helper.py +++ b/miasm2/expression/expression_helper.py @@ -128,7 +128,7 @@ def merge_sliceto_slice(args): op_propag_cst = ['+', '*', '^', '&', '|', '>>', - '<<', "a>>", ">>>", "/", "%", 'idiv', 'irem'] + '<<', "a>>", ">>>", "<<<", "/", "%", 'idiv', 'irem'] def is_pure_int(e): diff --git a/miasm2/expression/simplifications.py b/miasm2/expression/simplifications.py index e93ccd8c..d633cf3e 100644 --- a/miasm2/expression/simplifications.py +++ b/miasm2/expression/simplifications.py @@ -2,9 +2,10 @@ # Simplification methods library # # # -import miasm2.expression.expression as m2_expr -from miasm2.expression import simplifications_common, simplifications_cond +from miasm2.expression import simplifications_common +from miasm2.expression import simplifications_cond from miasm2.expression.expression_helper import fast_unify +import miasm2.expression.expression as m2_expr # Expression Simplifier # --------------------- diff --git a/miasm2/expression/simplifications_common.py b/miasm2/expression/simplifications_common.py index e620a97d..c907fe84 100644 --- a/miasm2/expression/simplifications_common.py +++ b/miasm2/expression/simplifications_common.py @@ -21,6 +21,7 @@ def simp_cst_propagation(e_s, e): op = e.op # simpl integer manip # int OP int => int + # TODO: <<< >>> << >> are architecture dependant if op in op_propag_cst: while (len(args) >= 2 and isinstance(args[-1], ExprInt) and @@ -46,7 +47,10 @@ def simp_cst_propagation(e_s, e): x2 = mod_size2int[i2.arg.size](i2.arg) o = mod_size2uint[i1.arg.size](x1 >> x2) elif op == '>>>': + rounds = i2.arg o = i1.arg >> i2.arg | i1.arg << (i1.size - i2.arg) + elif op == '<<<': + o = i1.arg << i2.arg | i1.arg >> (i1.size - i2.arg) elif op == '/': o = i1.arg / i2.arg elif op == '%': |