diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2017-02-13 11:17:03 +0100 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2017-02-17 14:50:40 +0100 |
| commit | ae4941a6e8777f3a24dedbb0410b34478b4ed15f (patch) | |
| tree | 4bf1d6eac3431562a574d74a02d730355e18efdb /miasm2/arch/x86/ctype.py | |
| parent | d30ea3788133fffc294602ee6cce88b407caaf4a (diff) | |
| download | miasm-ae4941a6e8777f3a24dedbb0410b34478b4ed15f.tar.gz miasm-ae4941a6e8777f3a24dedbb0410b34478b4ed15f.zip | |
Core: add C manipulators
This module implements C basic manipulators.
Diffstat (limited to 'miasm2/arch/x86/ctype.py')
| -rw-r--r-- | miasm2/arch/x86/ctype.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/miasm2/arch/x86/ctype.py b/miasm2/arch/x86/ctype.py new file mode 100644 index 00000000..6b5844d7 --- /dev/null +++ b/miasm2/arch/x86/ctype.py @@ -0,0 +1,50 @@ +from miasm2.core.objc import CTypeTemplate, ObjCDecl + + +class CTypeAMD64_unk(CTypeTemplate): + """Define C types sizes/alignement for x86_64 architecture""" + + obj_char = ObjCDecl("char", 1, 1) + obj_short = ObjCDecl("short", 2, 2) + obj_int = ObjCDecl("int", 4, 4) + obj_long = ObjCDecl("long", 8, 8) + + obj_uchar = ObjCDecl("uchar", 1, 1) + 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) + + + 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, + } |