diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2021-08-14 19:54:31 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2021-08-14 19:54:31 (GMT) |
commit | a6c0351774988094a51c9502f2a8e07633956263 (patch) | |
tree | dcaad9d00b6ce130d9af012286899ab877cc82cb /src/format/format-int.h | |
parent | 0daed1fa6212eb83b65ccd10c9f2c80bf12c6d27 (diff) |
Improve the object padding exploitation for operands.
Diffstat (limited to 'src/format/format-int.h')
-rw-r--r-- | src/format/format-int.h | 75 |
1 files changed, 38 insertions, 37 deletions
diff --git a/src/format/format-int.h b/src/format/format-int.h index de29751..11505d0 100644 --- a/src/format/format-int.h +++ b/src/format/format-int.h @@ -45,18 +45,22 @@ typedef SourceEndian (* format_get_endian_fc) (const GBinFormat *); /* Rythme des allocations pour les entrées de code */ #define EXTRA_POINT_BLOCK 20 -/* Informations glissées dans la structure GObject de GBinFormat */ -typedef union _fmt_obj_extra + +/* Informations glissées dans la structure GObject de GArchOperand */ +typedef struct _fmt_extra_data_t { - struct - { - FormatFlag flags; /* Informations complémentaires*/ + FormatFlag flags; /* Informations complémentaires*/ + +} fmt_extra_data_t; - }; +/* Encapsulation avec un verrou d'accès */ +typedef union _fmt_obj_extra_t +{ + fmt_extra_data_t data; /* Données embarquées */ + lockable_obj_extra_t lockable; /* Gestion d'accès aux fanions */ - gint lock; /* Gestion d'accès aux fanions */ +} fmt_obj_extra_t; -} fmt_obj_extra; /* Description d'une erreur */ typedef struct _fmt_error @@ -73,6 +77,19 @@ struct _GBinFormat { GKnownFormat parent; /* A laisser en premier */ +#if __SIZEOF_INT__ == __SIZEOF_LONG__ + + /** + * L'inclusion des informations suivantes dépend de l'architecture. + * + * Si la structure GObject possède un trou, on remplit de préférence + * ce dernier. + */ + + fmt_obj_extra_t extra; /* Externalisation embarquée */ + +#endif + virt_t *start_points[DPL_COUNT]; /* Départ de désassemblage */ size_t pt_allocated[DPL_COUNT]; /* Taille d'inscription allouée*/ size_t pt_count[DPL_COUNT]; /* Nombre de points enregistrés*/ @@ -97,53 +114,37 @@ struct _GBinFormat gint error_locked; /* Statut d'accès à la liste */ #endif -#if __SIZEOF_INT__ == __SIZEOF_LONG__ +}; - /** - * L'inclusion des informations suivantes dépend de l'architecture. - * - * Si la structure GObject possède un trou, on remplit de préférence - * ce dernier. - */ +/* Format binaire générique (classe) */ +struct _GBinFormatClass +{ + GKnownFormatClass parent; /* A laisser en premier */ - fmt_obj_extra extra; /* Externalisation embarquée */ + format_get_endian_fc get_endian; /* Boutisme employé */ -#endif + /* Signaux */ + + void (* symbol_added) (GBinFormat *, GBinSymbol *); + void (* symbol_removed) (GBinFormat *, GBinSymbol *); }; + /** * Accès aux informations éventuellement déportées. */ #if __SIZEOF_INT__ == __SIZEOF_LONG__ -# define INIT_BIN_FORMAT_EXTRA(fmt) fmt->extra.lock = 0 - -# define GET_BIN_FORMAT_EXTRA(fmt) &fmt->extra +# define GET_BIN_FORMAT_EXTRA(fmt) (fmt_extra_data_t *)&fmt->extra #else -# define INIT_BIN_FORMAT_EXTRA(fmt) INIT_GOBJECT_EXTRA(G_OBJECT(fmt)) - -# define GET_BIN_FORMAT_EXTRA(fmt) GET_GOBJECT_EXTRA(G_OBJECT(fmt), fmt_obj_extra) +# define GET_BIN_FORMAT_EXTRA(fmt) GET_GOBJECT_EXTRA(G_OBJECT(fmt), fmt_extra_data_t) #endif -/* Format binaire générique (classe) */ -struct _GBinFormatClass -{ - GKnownFormatClass parent; /* A laisser en premier */ - - format_get_endian_fc get_endian; /* Boutisme employé */ - - /* Signaux */ - - void (* symbol_added) (GBinFormat *, GBinSymbol *); - void (* symbol_removed) (GBinFormat *, GBinSymbol *); - -}; - /* ------------------------------ DECODAGE DE SYMBOLES ------------------------------ */ |