summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--src/arch/x86/operand.c24
2 files changed, 16 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 23f00e8..28d1fdf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
09-10-04 Cyrille Bagard <nocbos@gmail.com>
+ * src/arch/x86/operand.c:
+ Fix a bug in relative jump operands.
+
+09-10-04 Cyrille Bagard <nocbos@gmail.com>
+
* src/arch/x86/instruction.c:
* src/arch/x86/instruction.h:
* src/arch/x86/opcodes.h:
diff --git a/src/arch/x86/operand.c b/src/arch/x86/operand.c
index 3a37d0a..2c27176 100644
--- a/src/arch/x86/operand.c
+++ b/src/arch/x86/operand.c
@@ -789,36 +789,34 @@ GArchOperand *g_x86_relative_operand_new(const bin_t *data, off_t *pos, off_t le
{
GX86RelativeOperand *result; /* Structure à retourner */
off_t init_pos; /* Position avant lecture */
- uint8_t val8; /* Valeur sur 8 bits */
- uint16_t val16; /* Valeur sur 16 bits */
- uint32_t val32; /* Valeur sur 32 bits */
- uint32_t address32; /* Adresse finale visée */
+ int8_t val8; /* Valeur sur 8 bits */
+ int16_t val16; /* Valeur sur 16 bits */
+ int32_t val32; /* Valeur sur 32 bits */
+ vmpa_t address; /* Adresse finale visée */
init_pos = *pos;
switch (size)
{
case AOS_8_BITS_UNSIGNED:
- read_u8(&val8, data, pos, len, SRE_LITTLE);
- address32 = val8;
+ read_s8(&val8, data, pos, len, SRE_LITTLE);
+ address = base + (*pos - init_pos) + val8;
break;
case AOS_16_BITS_UNSIGNED:
- read_u16(&val16, data, pos, len, SRE_LITTLE);
- address32 = val16;
+ read_s16(&val16, data, pos, len, SRE_LITTLE);
+ address = base + (*pos - init_pos) + val16;
break;
case AOS_32_BITS_UNSIGNED:
- read_u32(&val32, data, pos, len, SRE_LITTLE);
- address32 = val32;
+ read_s32(&val32, data, pos, len, SRE_LITTLE);
+ address = base + (*pos - init_pos) + val32;
break;
default:
return NULL;
break;
}
- address32 += base + (*pos - init_pos);
-
result = g_object_new(G_TYPE_X86_RELATIVE_OPERAND, NULL);
- result->immediate = g_imm_operand_new_from_value(AOS_32_BITS/*FIXME*/, address32);
+ result->immediate = g_imm_operand_new_from_value(AOS_32_BITS/*FIXME*/, (uint32_t)address/* FIXME */);
return G_ARCH_OPERAND(result);