diff options
Diffstat (limited to 'plugins/arm/v7/operands/register.c')
-rw-r--r-- | plugins/arm/v7/operands/register.c | 58 |
1 files changed, 52 insertions, 6 deletions
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; |