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/arch/instructions/undefined-int.h | |
parent | 0daed1fa6212eb83b65ccd10c9f2c80bf12c6d27 (diff) |
Improve the object padding exploitation for operands.
Diffstat (limited to 'src/arch/instructions/undefined-int.h')
-rw-r--r-- | src/arch/instructions/undefined-int.h | 56 |
1 files changed, 25 insertions, 31 deletions
diff --git a/src/arch/instructions/undefined-int.h b/src/arch/instructions/undefined-int.h index 8a648cf..491ec31 100644 --- a/src/arch/instructions/undefined-int.h +++ b/src/arch/instructions/undefined-int.h @@ -32,63 +32,57 @@ /* Informations glissées dans la structure GObject de GArchInstruction */ -typedef union _undef_obj_extra +typedef struct _undef_extra_data_t { - struct - { - InstrExpectedBehavior behavior; /* Conséquences réelles */ + /** + * Le champ uid de la structure parente attendue conduit à une taille + * alignée sur 2 octets, donc à une taille totale de 4 octets ce qui + * représente la limite maximale de taille supportée. + * + * Pour 3 octets à la base, qui devraient laisser 8 - 1 octets disponbibles + * en incluant le bit de verrouillage. + * + * On reproduit donc la structure instr_extra_data_t ici, en basculant + * l'énumération InstrExpectedBehavior en champ de bits. + */ - }; + itid_t uid; /* Identifiant unique du type */ + ArchInstrFlag flags; /* Informations complémentaires*/ - gint lock; /* Gestion d'accès aux fanions */ + unsigned int behavior : 2; /* Conséquences réelles */ + +} undef_extra_data_t; -} undef_obj_extra; /* Définition générique d'une instruction au comportement non défini (instance) */ struct _GUndefInstruction { GArchInstruction 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. - */ - - undef_obj_extra extra; /* Externalisation embarquée */ +}; -#endif +/* Définition générique d'une instruction au comportement non défini (classe) */ +struct _GUndefInstructionClass +{ + GArchInstructionClass parent; /* A laisser en premier */ }; + /** * Accès aux informations éventuellement déportées. */ #if __SIZEOF_INT__ == __SIZEOF_LONG__ -# define INIT_UNDEF_INSTR_EXTRA(ins) ins->extra.lock = 0 - -# define GET_UNDEF_INSTR_EXTRA(ins) &ins->extra +# define GET_UNDEF_INSTR_EXTRA(ins) (undef_extra_data_t *)&ins->extra #else -# define INIT_UNDEF_INSTR_EXTRA(ins) INIT_GOBJECT_EXTRA(G_OBJECT(ins)) - -# define GET_UNDEF_INSTR_EXTRA(ins) GET_GOBJECT_EXTRA(G_OBJECT(ins), undef_obj_extra) +# define GET_UNDEF_INSTR_EXTRA(ins) GET_GOBJECT_EXTRA(G_OBJECT(ins), undef_extra_data_t) #endif -/* Définition générique d'une instruction au comportement non défini (classe) */ -struct _GUndefInstructionClass -{ - GArchInstructionClass parent; /* A laisser en premier */ - -}; - #endif /* _ARCH_INSTRUCTIONS_UNDEFINED_INT_H */ |