diff options
Diffstat (limited to 'src/arch/instruction-int.h')
-rw-r--r-- | src/arch/instruction-int.h | 63 |
1 files changed, 61 insertions, 2 deletions
diff --git a/src/arch/instruction-int.h b/src/arch/instruction-int.h index af897b0..fcb5453 100644 --- a/src/arch/instruction-int.h +++ b/src/arch/instruction-int.h @@ -27,6 +27,7 @@ #include "instruction.h" #include "../common/array.h" +#include "../glibext/objhole.h" @@ -58,6 +59,38 @@ typedef GBufferLine * (* print_instruction_fc) (const GArchInstruction *, GBuffe typedef void (* get_instruction_rw_regs_fc) (const GArchInstruction *, GArchRegister ***, size_t *, GArchRegister ***, size_t *); +/* Informations glissées dans la structure GObject de GArchInstruction */ +typedef union _instr_obj_extra +{ + struct + { + itid_t uid; /* Identifiant unique du type */ + + ArchInstrFlag flags; /* Informations complémentaires*/ + + }; + + gint lock; /* Gestion d'accès aux fanions */ + +} instr_obj_extra; + +/** + * Choix du bit de verrou pour le champ "lock". + */ + +#if __BYTE_ORDER == __LITTLE_ENDIAN + +# define INSTR_EXTRA_LOCK_BIT 31 + +#elif __BYTE_ORDER == __BIG_ENDIAN + +# define INSTR_EXTRA_LOCK_BIT 0 + +#else + +# error "Unknown byte order" + +#endif /* Définition générique d'une instruction d'architecture (instance) */ struct _GArchInstruction @@ -93,12 +126,38 @@ struct _GArchInstruction flat_array_t *from; /* Origines des références */ flat_array_t *to; /* Instructions visées */ - itid_t uid; /* Identifiant unique du type */ +#if __SIZEOF_INT__ == __SIZEOF_LONG__ - ArchInstrFlag flags; /* Informations complémentaires*/ + /** + * 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. + */ + + instr_obj_extra extra; /* Externalisation embarquée */ + +#endif }; +/** + * Accès aux informations éventuellement déportées. + */ + +#if __SIZEOF_INT__ == __SIZEOF_LONG__ + +# define INIT_ARCH_INSTR_EXTRA(ins) ins->extra.lock = 0 + +# define GET_ARCH_INSTR_EXTRA(ins) &ins->extra + +#else + +# define INIT_ARCH_INSTR_EXTRA(ins) INIT_GOBJECT_EXTRA(G_OBJECT(ins)) + +# define GET_ARCH_INSTR_EXTRA(ins) GET_GOBJECT_EXTRA(G_OBJECT(ins), instr_obj_extra) + +#endif /* Définition générique d'une instruction d'architecture (classe) */ struct _GArchInstructionClass |