summaryrefslogtreecommitdiff
path: root/src/arch/arm/v7/helpers.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/arm/v7/helpers.h')
-rw-r--r--src/arch/arm/v7/helpers.h106
1 files changed, 68 insertions, 38 deletions
diff --git a/src/arch/arm/v7/helpers.h b/src/arch/arm/v7/helpers.h
index 394302b..4ef7087 100644
--- a/src/arch/arm/v7/helpers.h
+++ b/src/arch/arm/v7/helpers.h
@@ -29,6 +29,8 @@
#include "pseudo.h"
+#include "operands/maccess.h"
+#include "operands/offset.h"
#include "operands/shift.h"
#include "../../operand.h"
@@ -36,48 +38,48 @@
-#define ARMExpandImm_C(imm12, c) \
- ({ \
- GArchOperand *__result; \
- uint32_t __val; \
- if (armv7_arm_expand_imm_c(imm12, (bool []) { c }, &__val)) \
- __result = g_imm_operand_new_from_value(MDS_32_BITS_UNSIGNED, __val); \
- else \
- __result = NULL; \
- __result; \
+#define ARMExpandImm_C(imm12, c) \
+ ({ \
+ GArchOperand *__result; \
+ uint32_t __val; \
+ if (armv7_arm_expand_imm_c(imm12, (bool []) { c }, &__val)) \
+ __result = g_imm_operand_new_from_value(MDS_32_BITS_UNSIGNED, __val); \
+ else \
+ __result = NULL; \
+ __result; \
})
-#define ARMExpandImm(imm12) \
- ({ \
- GArchOperand *__result; \
- uint32_t __val; \
- if (armv7_arm_expand_imm(imm12, &__val)) \
- __result = g_imm_operand_new_from_value(MDS_32_BITS_UNSIGNED, __val); \
- else \
- __result = NULL; \
- __result; \
+#define ARMExpandImm(imm12) \
+ ({ \
+ GArchOperand *__result; \
+ uint32_t __val; \
+ if (armv7_arm_expand_imm(imm12, &__val)) \
+ __result = g_imm_operand_new_from_value(MDS_32_BITS_UNSIGNED, __val); \
+ else \
+ __result = NULL; \
+ __result; \
})
-#define ThumbExpandImm_C(imm12, c) \
- ({ \
- GArchOperand *__result; \
- uint32_t __val; \
- if (armv7_thumb_expand_imm_c(imm12, (bool []) { c }, &__val)) \
- __result = g_imm_operand_new_from_value(MDS_32_BITS_UNSIGNED, __val); \
- else \
- __result = NULL; \
- __result; \
+#define ThumbExpandImm_C(imm12, c) \
+ ({ \
+ GArchOperand *__result; \
+ uint32_t __val; \
+ if (armv7_thumb_expand_imm_c(imm12, (bool []) { c }, &__val)) \
+ __result = g_imm_operand_new_from_value(MDS_32_BITS_UNSIGNED, __val); \
+ else \
+ __result = NULL; \
+ __result; \
})
-#define ThumbExpandImm(imm12) \
- ({ \
- GArchOperand *__result; \
- uint32_t __val; \
- if (armv7_thumb_expand_imm(imm12, &__val)) \
- __result = g_imm_operand_new_from_value(MDS_32_BITS_UNSIGNED, __val); \
- else \
- __result = NULL; \
- __result; \
+#define ThumbExpandImm(imm12) \
+ ({ \
+ GArchOperand *__result; \
+ uint32_t __val; \
+ if (armv7_thumb_expand_imm(imm12, &__val)) \
+ __result = g_imm_operand_new_from_value(MDS_32_BITS_UNSIGNED, __val); \
+ else \
+ __result = NULL; \
+ __result; \
})
@@ -86,8 +88,8 @@
-#define DecodeImmShift(type, imm5) \
- ({ \
+#define DecodeImmShift(type, imm5) \
+ ({ \
GArchOperand *__result; \
SRType __shift_t; \
uint32_t __shift_n; \
@@ -142,6 +144,34 @@ return shift_t;
+
+
+
+/**
+ * Glue purement interne.
+ */
+
+
+#define MakeAccessOffset(add, off) \
+ g_armv7_offset_operand_new(add, off)
+
+
+#define MakeMemoryAccess(base, off, add, wr) \
+ ({ \
+ GArchOperand *__off; \
+ __off = MakeAccessOffset(add, off); \
+ g_armv7_maccess_operand_new(base, __off, wr); \
+ })
+
+
+#define MakeMemoryNotIndexed(base, wr) \
+ g_armv7_maccess_operand_new(base, NULL, wr)
+
+
+
+
+
+
/* Effectue une rotation vers la droit d'une valeur. */
GArchOperand *ror_armv7_imm(uint32_t, unsigned int);