about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorserpilliere <devnull@localhost>2014-08-22 16:07:32 +0200
committerserpilliere <devnull@localhost>2014-08-22 16:07:32 +0200
commitab84e4dedfafb52efe8f9f04151f0e026b00476d (patch)
tree7496b3a201519ab293c46bd810063a6129c531b7
parentc7ee5b9d06b171cb39104d8f577bf82d78a975f1 (diff)
downloadmiasm-ab84e4dedfafb52efe8f9f04151f0e026b00476d.tar.gz
miasm-ab84e4dedfafb52efe8f9f04151f0e026b00476d.zip
mips32: fix jal offset; fix instr pc/sp; fix asm endianess
-rw-r--r--miasm2/arch/mips32/arch.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/miasm2/arch/mips32/arch.py b/miasm2/arch/mips32/arch.py
index 447669ef..ff3c90ec 100644
--- a/miasm2/arch/mips32/arch.py
+++ b/miasm2/arch/mips32/arch.py
@@ -96,7 +96,7 @@ class instruction_mips32(instruction):
         return i
 
     def dstflow2label(self, symbol_pool):
-        if self.name == "J":
+        if self.name in ["J", 'JAL']:
             e = self.args[0].arg
             ad = (self.offset & (0xFFFFFFFF ^ ((1<< 28)-1))) + e
             l = symbol_pool.getby_offset_create(ad)
@@ -188,8 +188,8 @@ class mn_mips32(cls_mn):
     all_mn_mode = defaultdict(list)
     all_mn_name = defaultdict(list)
     all_mn_inst = defaultdict(list)
-    pc = PC
-    sp = SP
+    pc = {'l':PC, 'b':PC}
+    sp = {'l':SP, 'b':SP}
     instruction = instruction_mips32
     max_instruction_len = 4
 
@@ -252,7 +252,13 @@ class mn_mips32(cls_mn):
 
     def value(self, mode):
         v = super(mn_mips32, self).value(mode)
-        return [x for x in v]
+        if mode == 'l':
+            return [x[::-1] for x in v]
+        elif mode == 'b':
+            return [x for x in v]
+        else:
+            raise NotImplementedError('bad attrib')
+
 
 
 def mips32op(name, fields, args=None, alias=False):