summaryrefslogtreecommitdiff
path: root/src/arch/arm/v7/operands/maccess.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-05-22 15:43:43 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-05-22 15:43:43 (GMT)
commit7577eadd4e871d467f747c4927a1b1984d6a7606 (patch)
treee72a2fd5c1619e60402a678b0559079ed267eab0 /src/arch/arm/v7/operands/maccess.c
parent33aa90b022e7d711a733ca7eb62c0b285f974317 (diff)
Extended the compiler to transform all the new ARMv7 encoding definitions.
Diffstat (limited to 'src/arch/arm/v7/operands/maccess.c')
-rw-r--r--src/arch/arm/v7/operands/maccess.c46
1 files changed, 39 insertions, 7 deletions
diff --git a/src/arch/arm/v7/operands/maccess.c b/src/arch/arm/v7/operands/maccess.c
index 56ad0a3..e3e62fb 100644
--- a/src/arch/arm/v7/operands/maccess.c
+++ b/src/arch/arm/v7/operands/maccess.c
@@ -24,6 +24,9 @@
#include "maccess.h"
+#include <assert.h>
+
+
#include "../../../operand-int.h"
@@ -36,6 +39,7 @@ struct _GArmV7MAccessOperand
GArchOperand *base; /* Base de l'accès en mémoire */
GArchOperand *offset; /* Décallage pour l'adresse */
GArchOperand *shift; /* Décallage pour le décallage */
+ bool not_post_indexed; /* Positio du décallage */
bool write_back; /* Mise à jour de la base */
};
@@ -164,10 +168,11 @@ static void g_armv7_maccess_operand_finalize(GArmV7MAccessOperand *operand)
/******************************************************************************
* *
-* Paramètres : base = représente le registre de la base d'accès. *
-* offset = détermine le décallage entre l'adresse et la base. *
-* shift = opération de décallage pour jouer sur le décallage. *
-* writeb = indique une mise à jour de la base après usage. *
+* Paramètres : base = représente le registre de la base d'accès. *
+* offset = détermine le décallage entre l'adresse et la base. *
+* shift = opération de décallage pour jouer sur le décallage.*
+* indexed = précise la forme donnée au décallage à appliquer. *
+* wback = indique une mise à jour de la base après usage. *
* *
* Description : Crée un accès à la mémoire depuis une base et un décallage. *
* *
@@ -177,7 +182,7 @@ static void g_armv7_maccess_operand_finalize(GArmV7MAccessOperand *operand)
* *
******************************************************************************/
-GArchOperand *g_armv7_maccess_operand_new(GArchOperand *base, GArchOperand *offset, GArchOperand *shift, bool writeb)
+GArchOperand *g_armv7_maccess_operand_new(GArchOperand *base, GArchOperand *offset, GArchOperand *shift, bool indexed, bool wback)
{
GArmV7MAccessOperand *result; /* Structure à retourner */
@@ -186,7 +191,9 @@ GArchOperand *g_armv7_maccess_operand_new(GArchOperand *base, GArchOperand *offs
result->base = base;
result->offset = offset;
result->shift = shift;
- result->write_back = writeb;
+
+ result->not_post_indexed = indexed;
+ result->write_back = wback;
return G_ARCH_OPERAND(result);
@@ -213,6 +220,9 @@ static void g_armv7_maccess_operand_print(const GArmV7MAccessOperand *operand, G
g_arch_operand_print(operand->base, line, syntax);
+ if (!operand->not_post_indexed)
+ g_buffer_line_insert_text(line, BLC_ASSEMBLY, "]", 1, RTT_HOOK);
+
if (operand->offset != NULL)
{
g_buffer_line_insert_text(line, BLC_ASSEMBLY, ",", 1, RTT_PUNCT);
@@ -224,6 +234,8 @@ static void g_armv7_maccess_operand_print(const GArmV7MAccessOperand *operand, G
if (operand->shift != NULL)
{
+ assert(operand->not_post_indexed);
+
g_buffer_line_insert_text(line, BLC_ASSEMBLY, ",", 1, RTT_PUNCT);
g_buffer_line_insert_text(line, BLC_ASSEMBLY, " ", 1, RTT_RAW);
@@ -231,7 +243,8 @@ static void g_armv7_maccess_operand_print(const GArmV7MAccessOperand *operand, G
}
- g_buffer_line_insert_text(line, BLC_ASSEMBLY, "]", 1, RTT_HOOK);
+ if (operand->not_post_indexed)
+ g_buffer_line_insert_text(line, BLC_ASSEMBLY, "]", 1, RTT_HOOK);
if (operand->write_back)
g_buffer_line_insert_text(line, BLC_ASSEMBLY, "!", 1, RTT_PUNCT);
@@ -300,6 +313,25 @@ GArchOperand *g_armv7_maccess_operand_get_shift(const GArmV7MAccessOperand *oper
* *
* Paramètres : operand = opérande à consulter. *
* *
+* Description : Indique si le décallage est post-indexé. *
+* *
+* Retour : Statut des opérations menées. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool g_armv7_maccess_operand_is_post_indexed(const GArmV7MAccessOperand *operand)
+{
+ return !operand->not_post_indexed;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à consulter. *
+* *
* Description : Indique si la base est mise à jour après usage. *
* *
* Retour : Statut des opérations menées. *