diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2009-10-04 13:36:02 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2009-10-04 13:36:02 (GMT) |
commit | 070649a6c2d434208a202d4f09a3256cd3bbfe78 (patch) | |
tree | 582486a496fe145677ebb0942813251280082eac /src/arch | |
parent | b39b6867afbadd38476328201c07527ad17af60d (diff) |
Fixed a bug in relative jump operands.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@124 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/x86/operand.c | 24 |
1 files changed, 11 insertions, 13 deletions
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); |