about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2017-02-13 08:12:51 +0100
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2017-02-13 15:03:30 +0100
commitf5368a9521470401fb396a0532904055379743a8 (patch)
tree16eba849b638b004cf39fdfa8553a4ac76659766
parent528d5380aa30b8e2790119c1b26496fd8ea99589 (diff)
downloadmiasm-f5368a9521470401fb396a0532904055379743a8.tar.gz
miasm-f5368a9521470401fb396a0532904055379743a8.zip
Core/cpu: '_' label
Use '_' in assembly to reference address next to current instruction
-rw-r--r--miasm2/core/cpu.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/miasm2/core/cpu.py b/miasm2/core/cpu.py
index 4dd7fba3..ffca318b 100644
--- a/miasm2/core/cpu.py
+++ b/miasm2/core/cpu.py
@@ -961,6 +961,9 @@ class instruction(object):
     def get_asm_offset(self, expr):
         return m2_expr.ExprInt(self.offset, expr.size)
 
+    def get_asm_next_offset(self, expr):
+        return m2_expr.ExprInt(self.offset+self.l, expr.size)
+
     def resolve_args_with_symbols(self, symbols=None):
         if symbols is None:
             symbols = {}
@@ -977,6 +980,9 @@ class instruction(object):
                     if name == '$':
                         fixed_ids[x] = self.get_asm_offset(x)
                         continue
+                    if name == '_':
+                        fixed_ids[x] = self.get_asm_next_offset(x)
+                        continue
                     if not name in symbols:
                         raise ValueError('unresolved symbol! %r' % x)
                 else: