about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2020-04-09 22:25:40 +0200
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2020-04-09 22:25:40 +0200
commit3a332c925b07ab679791bf3f2558cbfa1e72eb9c (patch)
tree8f5a098ef5349811b507d62da0fdec728242abc9
parent7f0410a5e9b70070fa9187b5613dc3b1692908a2 (diff)
downloadmiasm-3a332c925b07ab679791bf3f2558cbfa1e72eb9c.tar.gz
miasm-3a332c925b07ab679791bf3f2558cbfa1e72eb9c.zip
Fix mips arch tipo
-rw-r--r--miasm/arch/mips32/arch.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/miasm/arch/mips32/arch.py b/miasm/arch/mips32/arch.py
index d0403ba0..f1e52585 100644
--- a/miasm/arch/mips32/arch.py
+++ b/miasm/arch/mips32/arch.py
@@ -95,8 +95,9 @@ class instruction_mips32(cpu.instruction):
 
     def dstflow2label(self, loc_db):
         if self.name in ["J", 'JAL']:
-            expr = int(self.args[0])
-            addr = (self.offset & (0xFFFFFFFF ^ ((1<< 28)-1))) + expr
+            expr = self.args[0]
+            offset = int(expr)
+            addr = ((self.offset & (0xFFFFFFFF ^ ((1<< 28)-1))) + offset) & int(expr.mask)
             loc_key = loc_db.get_or_create_offset_location(addr)
             self.args[0] = ExprLoc(loc_key, expr.size)
             return
@@ -106,7 +107,7 @@ class instruction_mips32(cpu.instruction):
 
         if not isinstance(expr, ExprInt):
             return
-        addr = int(expr) + self.offset
+        addr = (int(expr) + self.offset) & int(expr.mask)
         loc_key = loc_db.get_or_create_offset_location(addr)
         self.args[ndx] = ExprLoc(loc_key, expr.size)