diff options
| author | serpilliere <devnull@localhost> | 2014-07-03 10:30:46 +0200 |
|---|---|---|
| committer | serpilliere <devnull@localhost> | 2014-07-03 10:30:46 +0200 |
| commit | 6abe57ac02b5ddecbb1b43afa0b4aefa5230e709 (patch) | |
| tree | 6b75d4353a5fd508493298a93911af502d46272b /miasm2/core/cpu.py | |
| parent | 95de9efd4f769b461204d238261bd7cac25ba8b3 (diff) | |
| download | miasm-6abe57ac02b5ddecbb1b43afa0b4aefa5230e709.tar.gz miasm-6abe57ac02b5ddecbb1b43afa0b4aefa5230e709.zip | |
Core: $ symbol can be customized for relative offset tricks
For exemple, in arm: LDR R1, [PC, label-$] Here, $ will be replaced by label - (offset + 8) So R1 will be loaded by dword at address label
Diffstat (limited to 'miasm2/core/cpu.py')
| -rw-r--r-- | miasm2/core/cpu.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/miasm2/core/cpu.py b/miasm2/core/cpu.py index c01759f4..b1034327 100644 --- a/miasm2/core/cpu.py +++ b/miasm2/core/cpu.py @@ -960,6 +960,9 @@ class instruction(object): o += self.gen_args(args) return o + def get_asm_offset(self, x): + return ExprInt_from(x, self.offset) + def resolve_args_with_symbols(self, symbols=None): if symbols is None: symbols = {} @@ -978,8 +981,7 @@ class instruction(object): name = x.name # special symbol if name == '$': - value = ExprInt_from(x, self.offset) - fixed_ids[x] = value + fixed_ids[x] = self.get_asm_offset(x) continue if not name in symbols: continue |