about summary refs log tree commit diff stats
path: root/miasm2/arch/mep/ira.py
diff options
context:
space:
mode:
authorGuillaume Valadon <guillaume@valadon.net>2018-06-15 12:10:10 +0200
committerGuillaume Valadon <guillaume@valadon.net>2018-07-12 22:50:51 +0200
commitb8e5038798b0dece628846acb5ad25d9d4e60395 (patch)
tree932dd2676afcf0c4ba6bf0c57d3b574954461ad2 /miasm2/arch/mep/ira.py
parent82eb5f6eb197fc59d2e9ae21cfda05a1868e462e (diff)
downloadmiasm-b8e5038798b0dece628846acb5ad25d9d4e60395.tar.gz
miasm-b8e5038798b0dece628846acb5ad25d9d4e60395.zip
Toshiba MeP support
Diffstat (limited to 'miasm2/arch/mep/ira.py')
-rw-r--r--miasm2/arch/mep/ira.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/miasm2/arch/mep/ira.py b/miasm2/arch/mep/ira.py
new file mode 100644
index 00000000..34808656
--- /dev/null
+++ b/miasm2/arch/mep/ira.py
@@ -0,0 +1,45 @@
+# Toshiba MeP-c4 - miasm IR analysis
+# Guillaume Valadon <guillaume@valadon.net>
+
+from miasm2.arch.mep.sem import ir_mepb, ir_mepl
+from miasm2.ir.analysis import ira
+
+
+class ir_a_mepb(ir_mepb, ira):
+    """MeP high level IR manipulations - Big Endian
+
+    Notes:
+        - it is mandatory for symbolic execution.
+    """
+
+    def __init__(self, loc_db=None):
+        ir_mepb.__init__(self, loc_db)
+        self.ret_reg = self.arch.regs.R0
+
+    # Note: the following are abstract method and must be implemented
+    def sizeof_char(self):
+        "Return the size of a char in bits"
+        return 8
+
+    def sizeof_short(self):
+        "Return the size of a short in bits"
+        return 16
+
+    def sizeof_int(self):
+        "Return the size of an int in bits"
+        return 32
+
+    def sizeof_long(self):
+        "Return the size of a long in bits"
+        return 32
+
+    def sizeof_pointer(self):
+        "Return the size of a void* in bits"
+        return 32
+
+
+class ir_a_mepl(ir_mepl, ir_a_mepb):
+    """MeP high level IR manipulations - Little Endian"""
+
+    def __init__(self, loc_db=None):
+        ir_a_mepb.__init__(self, loc_db)