diff options
Diffstat (limited to 'plugins/arm/v7/operands')
-rw-r--r-- | plugins/arm/v7/operands/maccess.c | 2 | ||||
-rw-r--r-- | plugins/arm/v7/operands/register.c | 58 | ||||
-rw-r--r-- | plugins/arm/v7/operands/register.h | 3 |
3 files changed, 56 insertions, 7 deletions
diff --git a/plugins/arm/v7/operands/maccess.c b/plugins/arm/v7/operands/maccess.c index 5359527..f5307f7 100644 --- a/plugins/arm/v7/operands/maccess.c +++ b/plugins/arm/v7/operands/maccess.c @@ -268,7 +268,7 @@ static void g_armv7_maccess_operand_print(const GArmV7MAccessOperand *operand, G if (!operand->post_indexed) g_buffer_line_append_text(line, BLC_ASSEMBLY, "]", 1, RTT_HOOK, NULL); - if (operand->write_back) + if (operand->post_indexed && operand->write_back) g_buffer_line_append_text(line, BLC_ASSEMBLY, "!", 1, RTT_PUNCT, NULL); } diff --git a/plugins/arm/v7/operands/register.c b/plugins/arm/v7/operands/register.c index 4a5f852..80a3769 100644 --- a/plugins/arm/v7/operands/register.c +++ b/plugins/arm/v7/operands/register.c @@ -33,6 +33,9 @@ struct _GArmV7RegisterOperand { GRegisterOperand parent; /* Instance parente */ + unsigned int alignment; /* Eventuel alignement */ + bool has_alignment; /* Validité du champ */ + bool write_back; /* Mise à jour du registre ? */ }; @@ -223,6 +226,28 @@ GArchOperand *g_armv7_register_operand_new(GArmV7Register *reg) /****************************************************************************** * * * Paramètres : operand = opérande représentant un registre. * +* align = alignement imposé au registre. * +* * +* Description : Définit un alignement à appliquer à l'opérande de registre. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void g_armv7_register_operand_define_alignement(GArmV7RegisterOperand *operand, unsigned int align) +{ + operand->alignment = align; + + operand->has_alignment = true; + +} + + +/****************************************************************************** +* * +* Paramètres : operand = opérande représentant un registre. * * wback = indique si le registre est mis à jour après coup. * * * * Description : Détermine si le registre est mis à jour après l'opération. * @@ -288,7 +313,7 @@ static bool g_armv7_register_operand_unserialize(GArmV7RegisterOperand *operand, { bool result; /* Bilan à retourner */ GArchOperandClass *parent; /* Classe parente à consulter */ - uint8_t wback; /* Mise à jour après coup ? */ + uint8_t boolean; /* Valeur booléenne */ parent = G_ARCH_OPERAND_CLASS(g_armv7_register_operand_parent_class); @@ -296,10 +321,22 @@ static bool g_armv7_register_operand_unserialize(GArmV7RegisterOperand *operand, if (result) { - result = extract_packed_buffer(pbuf, &wback, sizeof(uint8_t), false); + result = extract_packed_buffer(pbuf, &boolean, sizeof(uint8_t), false); if (result) - operand->write_back = (wback == 1 ? true : false); + operand->has_alignment = (boolean == 1 ? true : false); + + } + + if (result && operand->has_alignment) + result = extract_packed_buffer(pbuf, &operand->alignment, sizeof(unsigned int), true); + + if (result) + { + result = extract_packed_buffer(pbuf, &boolean, sizeof(uint8_t), false); + + if (result) + operand->write_back = (boolean == 1 ? true : false); } @@ -326,7 +363,7 @@ static bool g_armv7_register_operand_serialize(const GArmV7RegisterOperand *oper { bool result; /* Bilan à retourner */ GArchOperandClass *parent; /* Classe parente à consulter */ - uint8_t wback; /* Mise à jour après coup ? */ + uint8_t boolean; /* Valeur booléenne */ parent = G_ARCH_OPERAND_CLASS(g_armv7_register_operand_parent_class); @@ -334,8 +371,17 @@ static bool g_armv7_register_operand_serialize(const GArmV7RegisterOperand *oper if (result) { - wback = (operand->write_back ? 1 : 0); - result = extend_packed_buffer(pbuf, &wback, sizeof(uint8_t), false); + boolean = (operand->has_alignment ? 1 : 0); + result = extend_packed_buffer(pbuf, &boolean, sizeof(uint8_t), false); + } + + if (result && operand->has_alignment) + result = extend_packed_buffer(pbuf, &operand->alignment, sizeof(unsigned int), true); + + if (result) + { + boolean = (operand->write_back ? 1 : 0); + result = extend_packed_buffer(pbuf, &boolean, sizeof(uint8_t), false); } return result; diff --git a/plugins/arm/v7/operands/register.h b/plugins/arm/v7/operands/register.h index 4a9c0c3..4806b89 100644 --- a/plugins/arm/v7/operands/register.h +++ b/plugins/arm/v7/operands/register.h @@ -57,6 +57,9 @@ GType g_armv7_register_operand_get_type(void); /* Crée un opérande visant un registre ARMv7. */ GArchOperand *g_armv7_register_operand_new(GArmV7Register *); +/* Définit un alignement à appliquer à l'opérande de registre. */ +void g_armv7_register_operand_define_alignement(GArmV7RegisterOperand *, unsigned int); + /* Détermine si le registre est mis à jour après l'opération. */ void g_armv7_register_operand_write_back(GArmV7RegisterOperand *, bool); |