diff options
| author | serpilliere <devnull@localhost> | 2011-11-15 12:46:39 +0100 |
|---|---|---|
| committer | serpilliere <devnull@localhost> | 2011-11-15 12:46:39 +0100 |
| commit | 1b09181aca20374bf0cf07e3cd8e349312bb7701 (patch) | |
| tree | 5b3e29bd7187e375f8ab67540c672e4a84c869dc /miasm/expression/expression.py | |
| parent | 5a76891aa9ccdfb80564deca836b038917efff06 (diff) | |
| download | focaccia-miasm-1b09181aca20374bf0cf07e3cd8e349312bb7701.tar.gz focaccia-miasm-1b09181aca20374bf0cf07e3cd8e349312bb7701.zip | |
add prefetch mem in emulation
Diffstat (limited to 'miasm/expression/expression.py')
| -rw-r--r-- | miasm/expression/expression.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/miasm/expression/expression.py b/miasm/expression/expression.py index 8fa9eb27..c9aba983 100644 --- a/miasm/expression/expression.py +++ b/miasm/expression/expression.py @@ -327,11 +327,10 @@ class ExprCond(Expr): return self.cond == a.cond and self.src1 == a.src1 and self.src2 == a.src2 def __hash__(self): return hash(self.cond)^hash(self.src1)^hash(self.src2) - + def toC(self): return "(%s?%s:%s)"%(self.cond.toC(), self.src1.toC(), self.src2.toC()) - - + class ExprMem(Expr): def __init__(self, arg, size = 32): if not isinstance(arg, Expr): raise 'arg must be expr' @@ -348,10 +347,11 @@ class ExprMem(Expr): def get_size(self): return self.size def reload_expr(self, g = {}): + if self in g: + return g[self] arg = self.arg if isinstance(arg, Expr): arg = self.arg.reload_expr(g) - return ExprMem(arg, self.size ) def __contains__(self, e): @@ -372,9 +372,8 @@ class ExprMem(Expr): def toC(self): return "MEM_LOOKUP_%.2d(%s)"%(self.size, self.arg.toC()) - - + class ExprOp(Expr): def __init__(self, op, *args): self.op, self.args = op, args |