diff options
| author | Camille Mougey <camille.mougey@cea.fr> | 2014-08-29 13:25:32 +0200 |
|---|---|---|
| committer | Camille Mougey <camille.mougey@cea.fr> | 2014-08-29 13:25:32 +0200 |
| commit | ea45a73e9d28407afd65a794253aad061ce15252 (patch) | |
| tree | 5bcd31a1bd000e9db88f40fe2beb4dc7f4a097bd | |
| parent | bd1dfe0154b07b969d7d02661b9b562cfdb05047 (diff) | |
| download | miasm-ea45a73e9d28407afd65a794253aad061ce15252.tar.gz miasm-ea45a73e9d28407afd65a794253aad061ce15252.zip | |
IRA: Add methods to get char, short, int, long, pointer sizes
| -rw-r--r-- | miasm2/arch/arm/ira.py | 15 | ||||
| -rw-r--r-- | miasm2/arch/mips32/ira.py | 14 | ||||
| -rw-r--r-- | miasm2/arch/x86/ira.py | 15 | ||||
| -rw-r--r-- | miasm2/ir/analysis.py | 20 |
4 files changed, 64 insertions, 0 deletions
diff --git a/miasm2/arch/arm/ira.py b/miasm2/arch/arm/ira.py index 7ff2c142..81d3bbbb 100644 --- a/miasm2/arch/arm/ira.py +++ b/miasm2/arch/arm/ira.py @@ -104,6 +104,21 @@ class ir_a_arm(ir_a_arm_base): def get_out_regs(self, b): return set([self.ret_reg, self.sp]) + def sizeof_char(self): + return 8 + + def sizeof_short(self): + return 16 + + def sizeof_int(self): + return 32 + + def sizeof_long(self): + return 32 + + def sizeof_pointer(self): + return 32 + class ir_a_armt(ir_armt, ir_a_arm): diff --git a/miasm2/arch/mips32/ira.py b/miasm2/arch/mips32/ira.py index 4dd33dc2..bf0ed413 100644 --- a/miasm2/arch/mips32/ira.py +++ b/miasm2/arch/mips32/ira.py @@ -69,4 +69,18 @@ class ir_a_mips32(ir_mips32, ira): def get_out_regs(self, b): return set([self.ret_reg, self.sp]) + def sizeof_char(self): + return 8 + + def sizeof_short(self): + return 16 + + def sizeof_int(self): + return 32 + + def sizeof_long(self): + return 32 + + def sizeof_pointer(self): + return 32 diff --git a/miasm2/arch/x86/ira.py b/miasm2/arch/x86/ira.py index 04cb4cca..c7dfb2ac 100644 --- a/miasm2/arch/x86/ira.py +++ b/miasm2/arch/x86/ira.py @@ -72,6 +72,21 @@ class ir_a_x86_32(ir_x86_32, ir_a_x86_16): ir_x86_32.__init__(self, symbol_pool) self.ret_reg = self.arch.regs.EAX + def sizeof_char(self): + return 8 + + def sizeof_short(self): + return 16 + + def sizeof_int(self): + return 32 + + def sizeof_long(self): + return 32 + + def sizeof_pointer(self): + return 32 + class ir_a_x86_64(ir_x86_64, ir_a_x86_16): diff --git a/miasm2/ir/analysis.py b/miasm2/ir/analysis.py index 5b65acca..c20c7f7a 100644 --- a/miasm2/ir/analysis.py +++ b/miasm2/ir/analysis.py @@ -226,3 +226,23 @@ class ira: eq irb.irs = [eqs] irb.lines = [None] + + def sizeof_char(self): + "Return the size of a char in bits" + raise NotImplementedError("Abstract method") + + def sizeof_short(self): + "Return the size of a short in bits" + raise NotImplementedError("Abstract method") + + def sizeof_int(self): + "Return the size of an int in bits" + raise NotImplementedError("Abstract method") + + def sizeof_long(self): + "Return the size of a long in bits" + raise NotImplementedError("Abstract method") + + def sizeof_pointer(self): + "Return the size of a void* in bits" + raise NotImplementedError("Abstract method") |