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.h57
1 files changed, 55 insertions, 2 deletions
diff --git a/src/arch/arm/v7/helpers.h b/src/arch/arm/v7/helpers.h
index 087b2e7..66a98f6 100644
--- a/src/arch/arm/v7/helpers.h
+++ b/src/arch/arm/v7/helpers.h
@@ -25,20 +25,73 @@
#define _ARCH_ARM_V7_HELPERS_H
-#include <stdbool.h>
-#include <stdint.h>
+#include <libio.h>
+#include "pseudo.h"
#include "../../operand.h"
+
+
+#define ARMExpandImm_C(imm12, c) \
+ ({ \
+ uint32_t __val; \
+ __val = armv7_arm_expand_imm_c(imm12, (bool []) { c }); \
+ g_imm_operand_new_from_value(MDS_32_BITS_UNSIGNED, __val); \
+ })
+
+#define ARMExpandImm(imm12) \
+ ({ \
+ uint32_t __val; \
+ __val = armv7_arm_expand_imm_c(imm12, NULL); \
+ g_imm_operand_new_from_value(MDS_32_BITS_UNSIGNED, __val); \
+ })
+
+
+
+
+
+#define ZeroExtend(x, n, i) \
+ ({ \
+ MemoryDataSize __mds; \
+ uint ## i ## _t __val; \
+ mds = MDS_ ## sz ## _BITS_UNSIGNED; \
+ __val = armv7_zero_extend(x, n, i); \
+ g_imm_operand_new_from_value(__mds, __val); \
+ })
+
+
+
+#define Zeros(i) \
+ ({ \
+ MemoryDataSize __mds; \
+ uint ## i ## _t __val; \
+ mds = MDS_ ## sz ## _BITS_UNSIGNED; \
+ __val = 0; \
+ g_imm_operand_new_from_value(__mds, __val); \
+ })
+
+
+
+
+
+/* Effectue une rotation vers la droit d'une valeur. */
+GArchOperand *ror_armv7_imm(uint32_t, unsigned int);
+
/* Crée un opérande de valeur immédiate avec extension de signe. */
GArchOperand *sign_extend_armv7_imm(uint32_t, bool, unsigned int);
+/* Etend une valeur immédiate en mode 'Thumb' ARMv7. */
+GArchOperand *thumb_expand_armv7_imm(uint32_t);
+
/* Crée un opérande représentant un registre ARMv7. */
GArchOperand *translate_armv7_register(uint8_t);
+/* Réalise un simple transtypage de valeur entière. */
+GArchOperand *zero_extend_armv7_imm(uint32_t, unsigned int);
+
#endif /* _ARCH_ARM_V7_HELPERS_H */