diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2017-02-20 14:41:08 +0100 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2017-05-15 21:29:34 +0200 |
| commit | 9e79f4338ad7cae991ee73902898e24782874ad5 (patch) | |
| tree | be4f8ecc5725357feff7a8aa364569665fee2eaa /miasm2/arch/x86/ctype.py | |
| parent | 3260f7867827195ea7c6ec37bc3a8687ce998f6d (diff) | |
| download | miasm-9e79f4338ad7cae991ee73902898e24782874ad5.tar.gz miasm-9e79f4338ad7cae991ee73902898e24782874ad5.zip | |
Core/Objc: improuve internal type representation
Diffstat (limited to 'miasm2/arch/x86/ctype.py')
| -rw-r--r-- | miasm2/arch/x86/ctype.py | 72 |
1 files changed, 43 insertions, 29 deletions
diff --git a/miasm2/arch/x86/ctype.py b/miasm2/arch/x86/ctype.py index 6b5844d7..0b8f3b46 100644 --- a/miasm2/arch/x86/ctype.py +++ b/miasm2/arch/x86/ctype.py @@ -1,7 +1,8 @@ -from miasm2.core.objc import CTypeTemplate, ObjCDecl +from miasm2.core.objc import CLeafTypes, ObjCDecl +from miasm2.core.ctypesmngr import CTypeId, CTypePtr -class CTypeAMD64_unk(CTypeTemplate): +class CTypeAMD64_unk(CLeafTypes): """Define C types sizes/alignement for x86_64 architecture""" obj_char = ObjCDecl("char", 1, 1) @@ -13,38 +14,51 @@ class CTypeAMD64_unk(CTypeTemplate): obj_ushort = ObjCDecl("ushort", 2, 2) obj_uint = ObjCDecl("uint", 4, 4) obj_ulong = ObjCDecl("ulong", 8, 8) + obj_void = ObjCDecl("void", 1, 1) obj_enum = ObjCDecl("enum", 4, 4) + obj_float = ObjCDecl("float", 4, 4) + obj_double = ObjCDecl("double", 8, 8) + obj_ldouble = ObjCDecl("ldouble", 16, 16) def __init__(self): self.types = { - ('char',): self.obj_char, - ('short',): self.obj_short, - ('int',): self.obj_int, - ('void',): self.obj_void, - ('enum',): self.obj_enum, - - ('signed', 'char'): self.obj_char, - ('unsigned', 'char'): self.obj_uchar, - ('signed', 'short', 'int'): self.obj_short, - ('short', 'int'): self.obj_short, - ('unsigned', 'short'): self.obj_ushort, - ('unsigned', 'short', 'int'): self.obj_ushort, - ('signed', 'int'): self.obj_int, - ('unsigned', 'int'): self.obj_uint, - ('long', 'int'): self.obj_long, - ('unsigned', 'long'): self.obj_ulong, - ('signed', 'long', 'int'): self.obj_long, - ('unsigned', 'long', 'int'): self.obj_ulong, - ('long',): self.obj_long, - ('unsigned', ): self.obj_uint, - - ('signed', 'long', 'long', 'int'): self.obj_long, - ('long', 'unsigned', 'int'): self.obj_ulong, - ('unsigned', 'long', 'long'): self.obj_ulong, - ('long', 'long', 'int'): self.obj_long, - ('unsigned', 'long', 'long', 'int'): self.obj_ulong, - ('void*',): self.obj_ulong, + CTypeId('char'): self.obj_char, + CTypeId('short'): self.obj_short, + CTypeId('int'): self.obj_int, + CTypeId('void'): self.obj_void, + CTypeId('long',): self.obj_long, + CTypeId('float'): self.obj_float, + CTypeId('double'): self.obj_double, + + CTypeId('signed', 'char'): self.obj_char, + CTypeId('unsigned', 'char'): self.obj_uchar, + + CTypeId('short', 'int'): self.obj_short, + CTypeId('signed', 'short'): self.obj_short, + CTypeId('signed', 'short', 'int'): self.obj_short, + CTypeId('unsigned', 'short'): self.obj_ushort, + CTypeId('unsigned', 'short', 'int'): self.obj_ushort, + + CTypeId('unsigned', ): self.obj_uint, + CTypeId('unsigned', 'int'): self.obj_uint, + CTypeId('signed', 'int'): self.obj_int, + + CTypeId('long', 'int'): self.obj_long, + CTypeId('long', 'long'): self.obj_long, + CTypeId('long', 'long', 'int'): self.obj_long, + CTypeId('signed', 'long', 'long'): self.obj_long, + CTypeId('unsigned', 'long', 'long'): self.obj_ulong, + CTypeId('signed', 'long', 'long', 'int'): self.obj_long, + CTypeId('unsigned', 'long', 'long', 'int'): self.obj_ulong, + + CTypeId('signed', 'long'): self.obj_long, + CTypeId('unsigned', 'long'): self.obj_ulong, + CTypeId('signed', 'long', 'int'): self.obj_long, + CTypeId('unsigned', 'long', 'int'): self.obj_ulong, + + CTypeId('long', 'double'): self.obj_ldouble, + CTypePtr(CTypeId('void')): self.obj_ulong, } |