summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-01-11 07:18:44 +0000
committerUlrich Drepper <drepper@redhat.com>2008-01-11 07:18:44 +0000
commit9dc49f58df3307f26c59b6eaa218c7cf7a2eca36 (patch)
tree25169550df4e756dc0eb1a1c5a12f8dbbac30436
parent6bc105fc2c2eb312d08db00b50f419ffbcc189f7 (diff)
More immediate operand fixes for x86 disassembler.
-rw-r--r--libcpu/i386_data.h16
-rw-r--r--tests/testfile45.S.bz2bin22707 -> 22657 bytes
-rw-r--r--tests/testfile45.expect.bz2bin74233 -> 73954 bytes
3 files changed, 13 insertions, 3 deletions
diff --git a/libcpu/i386_data.h b/libcpu/i386_data.h
index c1f2d5e7..5f66c610 100644
--- a/libcpu/i386_data.h
+++ b/libcpu/i386_data.h
@@ -507,7 +507,11 @@ FCT_ax (struct output_data *d)
bufp[(*bufcntp)++] = '%';
if (! is_16bit)
- bufp[(*bufcntp)++] = 'e';
+ bufp[(*bufcntp)++] = (
+#ifdef X86_64
+ (*d->prefixes & has_rex_w) ? 'r' :
+#endif
+ 'e');
bufp[(*bufcntp)++] = 'a';
bufp[(*bufcntp)++] = 'x';
@@ -694,8 +698,14 @@ FCT_imm (struct output_data *d)
{
if (*d->param_start + 4 > d->end)
return -1;
- uint32_t word = read_4ubyte_unaligned_inc (*d->param_start);
- needed = snprintf (&d->bufp[*bufcntp], avail, "$0x%" PRIx32, word);
+ int32_t word = read_4sbyte_unaligned_inc (*d->param_start);
+#ifdef X86_64
+ if (*d->prefixes & has_rex_w)
+ needed = snprintf (&d->bufp[*bufcntp], avail, "$0x%" PRIx64,
+ (int64_t) word);
+ else
+#endif
+ needed = snprintf (&d->bufp[*bufcntp], avail, "$0x%" PRIx32, word);
}
if ((size_t) needed > avail)
return (size_t) needed - avail;
diff --git a/tests/testfile45.S.bz2 b/tests/testfile45.S.bz2
index 2fc21289..c39be44b 100644
--- a/tests/testfile45.S.bz2
+++ b/tests/testfile45.S.bz2
Binary files differ
diff --git a/tests/testfile45.expect.bz2 b/tests/testfile45.expect.bz2
index cb054b63..539a03a2 100644
--- a/tests/testfile45.expect.bz2
+++ b/tests/testfile45.expect.bz2
Binary files differ