diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2009-10-05 23:22:01 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2009-10-05 23:22:01 (GMT) |
commit | d9be16271ab3fbb95d6c95baa92242358f0e7dfd (patch) | |
tree | 0e01400739a83d304cc9ecb20033d12b6003e9b9 /src/arch | |
parent | 34612ad3304e9064f38c3adce728f2a71352c981 (diff) |
Loaded .rel.plt symbols even for shared libraries.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@127 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/immediate.c | 64 | ||||
-rw-r--r-- | src/arch/immediate.h | 3 |
2 files changed, 67 insertions, 0 deletions
diff --git a/src/arch/immediate.c b/src/arch/immediate.c index 73a7648..56a6bfc 100644 --- a/src/arch/immediate.c +++ b/src/arch/immediate.c @@ -623,3 +623,67 @@ bool g_imm_operand_to_size_t(const GImmOperand *operand, size_t *value, bool *ne return result; } + + +/****************************************************************************** +* * +* Paramètres : operand = opérande à traiter. * +* value = valeur résultante. [OUT] * +* negative = indique si la valeur était négative à l'origine. * +* * +* Description : Convertit une valeur immédiate en valeur de type off_t. * +* * +* Retour : Bilan de l'opération. * +* * +* Remarques : - * +* * +******************************************************************************/ + +bool g_imm_operand_to_off_t(const GImmOperand *operand, off_t *value, bool *negative) +{ + bool result; /* Bilan à renvoyer */ + + *negative = g_imm_operand_is_negative(operand); + + switch (operand->size) + { + case AOS_8_BITS_UNSIGNED: + result = (sizeof(off_t) >= 1); + if (result) *value = operand->unsigned_imm.val8; + break; + case AOS_16_BITS_UNSIGNED: + result = (sizeof(off_t) >= 2); + if (result) *value = operand->unsigned_imm.val16; + break; + case AOS_32_BITS_UNSIGNED: + result = (sizeof(off_t) >= 4); + if (result) *value = operand->unsigned_imm.val32; + break; + case AOS_64_BITS_UNSIGNED: + result = (sizeof(off_t) >= 8); + if (result) *value = operand->unsigned_imm.val64; + break; + case AOS_8_BITS_SIGNED: + result = (sizeof(off_t) >= 1); + if (result) *value = (*negative ? -1 : 1 ) * operand->signed_imm.val8; + break; + case AOS_16_BITS_SIGNED: + result = (sizeof(off_t) >= 2); + if (result) *value = (*negative ? -1 : 1 ) * operand->signed_imm.val16; + break; + case AOS_32_BITS_SIGNED: + result = (sizeof(off_t) >= 4); + if (result) *value = (*negative ? -1 : 1 ) * operand->signed_imm.val32; + break; + case AOS_64_BITS_SIGNED: + result = (sizeof(off_t) >= 8); + if (result) *value = (*negative ? -1 : 1 ) * operand->signed_imm.val64; + break; + default: + result = false; + break; + } + + return result; + +} diff --git a/src/arch/immediate.h b/src/arch/immediate.h index d3e4624..63ce970 100644 --- a/src/arch/immediate.h +++ b/src/arch/immediate.h @@ -66,6 +66,9 @@ bool g_imm_operand_to_vmpa_t(const GImmOperand *, vmpa_t *); /* Convertit une valeur immédiate en valeur de type size_t. */ bool g_imm_operand_to_size_t(const GImmOperand *, size_t *, bool *); +/* Convertit une valeur immédiate en valeur de type off_t. */ +bool g_imm_operand_to_off_t(const GImmOperand *, off_t *, bool *); + #endif /* _ARCH_IMMEDIATE_H */ |