about summary refs log tree commit diff stats
path: root/miasm/arch/mep/ira.py
blob: 021c19519da42d3b6964fd2fb134576f4f9ee7b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Toshiba MeP-c4 - miasm IR analysis
# Guillaume Valadon <guillaume@valadon.net>

from miasm.arch.mep.sem import Lifter_MEPb, Lifter_MEPl
from miasm.ir.analysis import LifterModelCall


class ir_a_mepb(Lifter_MEPb, LifterModelCall):
    """MeP high level IR manipulations - Big Endian

    Notes:
        - it is mandatory for symbolic execution.
    """

    def __init__(self, loc_db):
        Lifter_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(Lifter_MEPl, ir_a_mepb):
    """MeP high level IR manipulations - Little Endian"""

    def __init__(self, loc_db):
        ir_a_mepb.__init__(self, loc_db)