diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2014-12-05 22:32:21 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2014-12-05 22:32:21 (GMT) |
commit | 0a7b9b66bdcf386a36ec13ec480b52aa17406385 (patch) | |
tree | 95b9cfac29b50aa92eac9cbc9e754c9787f55438 /src/arch/arm/v7/helpers.h | |
parent | 12154652c576144405011b5bd267c15c9667f223 (diff) |
Defined a new kind of operands for memory accesses.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@436 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/arm/v7/helpers.h')
-rw-r--r-- | src/arch/arm/v7/helpers.h | 106 |
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); |