summaryrefslogtreecommitdiff
path: root/src/arch/x86
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2008-11-16 23:16:47 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2008-11-16 23:16:47 (GMT)
commit3d6e959ad3e56681ba39bd8f0a003b8a1aff132c (patch)
tree9a8c7608f60d05c8b968f443567fc77825fff8ff /src/arch/x86
parent12b4201890b4b2eefffaa6615b4b3076253dff6f (diff)
Took care of signed immediate values as well as unsigned ones.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@42 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/x86')
-rw-r--r--src/arch/x86/operand.c15
-rw-r--r--src/arch/x86/processor.c2
2 files changed, 9 insertions, 8 deletions
diff --git a/src/arch/x86/operand.c b/src/arch/x86/operand.c
index a028dc2..38e1468 100644
--- a/src/arch/x86/operand.c
+++ b/src/arch/x86/operand.c
@@ -179,7 +179,7 @@ asm_x86_operand *create_new_x86_operand(void)
* *
* Retour : true si la définition est opérée, false sinon. *
* *
-* Remarques : - *
+* Remarques : -  *
* *
******************************************************************************/
@@ -409,7 +409,7 @@ asm_x86_operand *x86_create_content1632_operand(const uint8_t *data, off_t *pos,
case 0x40:
result->displacement = create_new_x86_operand();
- if (!fill_imm_operand(ASM_OPERAND(result->displacement), AOS_8_BITS, data, pos, len))
+ if (!fill_imm_operand(ASM_OPERAND(result->displacement), AOS_8_BITS_SIGNED, data, pos, len))
{
(*pos) -= 2;
free(result->displacement);
@@ -420,7 +420,7 @@ asm_x86_operand *x86_create_content1632_operand(const uint8_t *data, off_t *pos,
case 0x80:
result->displacement = create_new_x86_operand();
- if (!fill_imm_operand(ASM_OPERAND(result->displacement), AOS_32_BITS, data, pos, len))
+ if (!fill_imm_operand(ASM_OPERAND(result->displacement), AOS_32_BITS_SIGNED, data, pos, len))
{
(*pos) -= 2;
free(result->displacement);
@@ -572,7 +572,7 @@ asm_x86_operand *x86_create_rm8_operand(const uint8_t *data, off_t *pos, off_t l
case 0x40:
result->displacement = create_new_x86_operand();
- if (!fill_imm_operand(ASM_OPERAND(result->displacement), AOS_8_BITS, data, pos, len))
+ if (!fill_imm_operand(ASM_OPERAND(result->displacement), AOS_8_BITS_SIGNED, data, pos, len))
{
free(result->displacement);
free(result);
@@ -766,7 +766,7 @@ asm_x86_operand *x86_create_rm1632_operand(const uint8_t *data, off_t *pos, off_
case 0x40:
result->displacement = create_new_x86_operand();
- if (!fill_imm_operand(ASM_OPERAND(result->displacement), AOS_8_BITS, data, pos, len))
+ if (!fill_imm_operand(ASM_OPERAND(result->displacement), AOS_8_BITS_SIGNED, data, pos, len))
{
free(result->displacement);
free(result);
@@ -776,7 +776,7 @@ asm_x86_operand *x86_create_rm1632_operand(const uint8_t *data, off_t *pos, off_
case 0x80:
result->displacement = create_new_x86_operand();
- if (!fill_imm_operand(ASM_OPERAND(result->displacement), AOS_32_BITS, data, pos, len))
+ if (!fill_imm_operand(ASM_OPERAND(result->displacement), AOS_32_BITS_SIGNED, data, pos, len))
{
free(result->displacement);
free(result);
@@ -1092,7 +1092,8 @@ void x86_print_reg_operand(const asm_x86_operand *operand, char *buffer, size_t
if (operand->displacement != NULL)
{
- strcat(buffer, "+"); /* TODO: n */
+ if (is_imm_operand_negative(operand->displacement)) strcat(buffer, "-");
+ else strcat(buffer, "+");
pos = strlen(buffer);
print_imm_operand(operand->displacement, &buffer[pos], len - pos, syntax);
diff --git a/src/arch/x86/processor.c b/src/arch/x86/processor.c
index 8be503c..820c6a1 100644
--- a/src/arch/x86/processor.c
+++ b/src/arch/x86/processor.c
@@ -494,7 +494,7 @@ void x86_print_instruction(const asm_x86_processor *proc, const exe_format *form
case AOT_IMM:
print_imm_operand(ASM_OPERAND(ASM_INSTRUCTION(instr)->operands[i]), opbuffer[i], 256, syntax);
- offset = ASM_OPERAND(ASM_INSTRUCTION(instr)->operands[i])->value.val32; /* FIXME !!! */
+ offset = ASM_OPERAND(ASM_INSTRUCTION(instr)->operands[i])->unsigned_imm.val32; /* FIXME !!! */
if (ASM_OPERAND(ASM_INSTRUCTION(instr)->operands[i])->size == proc->operand_size
&& resolve_exe_symbol(format, &label, &symtype, &offset))