diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2016-10-29 11:55:02 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2016-10-29 11:55:02 (GMT) |
commit | 945f58cb1e1b8b6dc444dd0668bd1a2986cd899e (patch) | |
tree | 1fc255ced81920e46036699cc55ffc9962807cc2 /src | |
parent | 38e455ebbbbf90ddbf552f95a1dfb3c544907587 (diff) |
Told GCC to pack enumerations to save memory space.
Diffstat (limited to 'src')
-rw-r--r-- | src/analysis/disass/fetch.c | 2 | ||||
-rw-r--r-- | src/arch/immediate.c | 144 | ||||
-rw-r--r-- | src/arch/instruction-int.h | 3 |
3 files changed, 7 insertions, 142 deletions
diff --git a/src/analysis/disass/fetch.c b/src/analysis/disass/fetch.c index 7d8161a..ab3f3c7 100644 --- a/src/analysis/disass/fetch.c +++ b/src/analysis/disass/fetch.c @@ -97,7 +97,7 @@ static void g_delayed_fetching_dispose(GDelayedFetching *); static void g_delayed_fetching_finalize(GDelayedFetching *); /* Crée une tâche de récupération d'instructions différée. */ -static GDelayedFetching *g_delayed_fetching_new(const GDelayedFetching *, unsigned int, virt_t); +static GDelayedFetching *g_delayed_fetching_new(const GDelayedFetching *, DisassPriorityLevel, virt_t); /* Assure la récupération d'instructions en différé. */ static void g_delayed_fetching_process(GDelayedFetching *, GtkExtStatusBar *); diff --git a/src/arch/immediate.c b/src/arch/immediate.c index 777ae14..9de8c39 100644 --- a/src/arch/immediate.c +++ b/src/arch/immediate.c @@ -44,32 +44,8 @@ struct _GImmOperand { GArchOperand parent; /* Instance parente */ - MemoryDataSize size; /* Taille de l'opérande */ uint64_t raw; /* Valeur transtypée */ - - /** - * Note : dans le cas d'une valeur signée, - * signed_imm contient la valeur lue/donnée, et - * unsigned_imm la valeur humainement lisible (ie. positive). - */ - - union - { - uint8_t val8; /* Valeur sur 8 bits */ - uint16_t val16; /* Valeur sur 16 bits */ - uint32_t val32; /* Valeur sur 32 bits */ - uint64_t val64; /* Valeur sur 64 bits */ - - } unsigned_imm; - - union - { - int8_t val8; /* Valeur sur 8 bits */ - int16_t val16; /* Valeur sur 16 bits */ - int32_t val32; /* Valeur sur 32 bits */ - int64_t val64; /* Valeur sur 64 bits */ - - } signed_imm; + MemoryDataSize size; /* Taille de l'opérande */ bool zpad; /* Ajoute des 0 à l'impression */ ImmOperandDisplay def_display; /* Type par défaut d'affichage */ @@ -1009,31 +985,7 @@ void g_imm_operand_as_uleb128(const GImmOperand *operand, uleb128_t *val) bool g_imm_operand_to_vmpa_t(const GImmOperand *operand, vmpa_t *addr) { - bool result; /* Bilan à renvoyer */ - - result = true; - - switch (operand->size) - { - case MDS_4_BITS_UNSIGNED: - case MDS_8_BITS_UNSIGNED: - *addr = operand->unsigned_imm.val8; - break; - case MDS_16_BITS_UNSIGNED: - *addr = operand->unsigned_imm.val16; - break; - case MDS_32_BITS_UNSIGNED: - *addr = operand->unsigned_imm.val32; - break; - case MDS_64_BITS_UNSIGNED: - *addr = operand->unsigned_imm.val64; - break; - default: - result = false; - break; - } - - return result; + return false; } @@ -1054,51 +1006,7 @@ bool g_imm_operand_to_vmpa_t(const GImmOperand *operand, vmpa_t *addr) bool g_imm_operand_to_size_t(const GImmOperand *operand, size_t *value, bool *negative) { - bool result; /* Bilan à renvoyer */ - - *negative = g_imm_operand_is_negative(operand); - - switch (operand->size) - { - case MDS_4_BITS_UNSIGNED: - case MDS_8_BITS_UNSIGNED: - result = (sizeof(size_t) >= 1); - if (result) *value = operand->unsigned_imm.val8; - break; - case MDS_16_BITS_UNSIGNED: - result = (sizeof(size_t) >= 2); - if (result) *value = operand->unsigned_imm.val16; - break; - case MDS_32_BITS_UNSIGNED: - result = (sizeof(size_t) >= 4); - if (result) *value = operand->unsigned_imm.val32; - break; - case MDS_64_BITS_UNSIGNED: - result = (sizeof(size_t) >= 8); - if (result) *value = operand->unsigned_imm.val64; - break; - case MDS_8_BITS_SIGNED: - result = (sizeof(size_t) >= 1); - if (result) *value = (*negative ? -1 : 1 ) * operand->signed_imm.val8; - break; - case MDS_16_BITS_SIGNED: - result = (sizeof(size_t) >= 2); - if (result) *value = (*negative ? -1 : 1 ) * operand->signed_imm.val16; - break; - case MDS_32_BITS_SIGNED: - result = (sizeof(size_t) >= 4); - if (result) *value = (*negative ? -1 : 1 ) * operand->signed_imm.val32; - break; - case MDS_64_BITS_SIGNED: - result = (sizeof(size_t) >= 8); - if (result) *value = (*negative ? -1 : 1 ) * operand->signed_imm.val64; - break; - default: - result = false; - break; - } - - return result; + return false; } @@ -1119,50 +1027,6 @@ bool g_imm_operand_to_size_t(const GImmOperand *operand, size_t *value, bool *ne bool g_imm_operand_to_off_t(const GImmOperand *operand, off_t *value, bool *negative) { - bool result; /* Bilan à renvoyer */ - - *negative = g_imm_operand_is_negative(operand); - - switch (operand->size) - { - case MDS_4_BITS_UNSIGNED: - case MDS_8_BITS_UNSIGNED: - result = (sizeof(off_t) >= 1); - if (result) *value = operand->unsigned_imm.val8; - break; - case MDS_16_BITS_UNSIGNED: - result = (sizeof(off_t) >= 2); - if (result) *value = operand->unsigned_imm.val16; - break; - case MDS_32_BITS_UNSIGNED: - result = (sizeof(off_t) >= 4); - if (result) *value = operand->unsigned_imm.val32; - break; - case MDS_64_BITS_UNSIGNED: - result = (sizeof(off_t) >= 8); - if (result) *value = operand->unsigned_imm.val64; - break; - case MDS_8_BITS_SIGNED: - result = (sizeof(off_t) >= 1); - if (result) *value = (*negative ? -1 : 1 ) * operand->signed_imm.val8; - break; - case MDS_16_BITS_SIGNED: - result = (sizeof(off_t) >= 2); - if (result) *value = (*negative ? -1 : 1 ) * operand->signed_imm.val16; - break; - case MDS_32_BITS_SIGNED: - result = (sizeof(off_t) >= 4); - if (result) *value = (*negative ? -1 : 1 ) * operand->signed_imm.val32; - break; - case MDS_64_BITS_SIGNED: - result = (sizeof(off_t) >= 8); - if (result) *value = (*negative ? -1 : 1 ) * operand->signed_imm.val64; - break; - default: - result = false; - break; - } - - return result; + return false; } diff --git a/src/arch/instruction-int.h b/src/arch/instruction-int.h index e4d886b..f2964e6 100644 --- a/src/arch/instruction-int.h +++ b/src/arch/instruction-int.h @@ -57,7 +57,6 @@ struct _GArchInstruction phys_t max_displayed_len; /* Quantité de code affichée */ - ArchInstrFlag flags; /* Informations complémentaires*/ const instr_hook_fc *hooks; /* Traitements complémentaires */ mrange_t range; /* Emplacement en mémoire */ @@ -74,6 +73,8 @@ struct _GArchInstruction gint hold_link_access; /* Suivi des verrouillages */ #endif + ArchInstrFlag flags; /* Informations complémentaires*/ + //get_instruction_rw_regs_fc get_rw_regs; /* Liste des registres liés */ //print_instruction_fc print; /* Imprime l'ensemble */ //get_instruction_keyword_fc get_key; /* Texte humain équivalent */ |