]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Fix a few instructions with immediate arguments.
authorUlrich Drepper <drepper@redhat.com>
Fri, 11 Jan 2008 06:17:06 +0000 (06:17 +0000)
committerUlrich Drepper <drepper@redhat.com>
Fri, 11 Jan 2008 06:17:06 +0000 (06:17 +0000)
libcpu/ChangeLog
libcpu/defs/i386
libcpu/i386_data.h
libcpu/i386_disasm.c
tests/ChangeLog
tests/testfile45.S.bz2
tests/testfile45.expect.bz2

index 8cf6be07c7f9c09a0eebf424b03c23e355c9e53b..d4280cbfd1d73909dcc3a58e7e94b332d2e8899b 100644 (file)
@@ -1,5 +1,7 @@
 2008-01-10  Ulrich Drepper  <drepper@redhat.com>
 
+       * defs/i386: Fix a few instructions with immediate arguments.
+
        * i386_disasm.c: Rewrite interface to callback functions for operands
        to take a single pointer to a structure.
        * i386_data.h: Adjust all functions.
index 29ea606ed9a80909b4855a75660bac285b8808d0..b545c48160f0594f8339fe1e4ec54f6082af5a26 100644 (file)
@@ -71,7 +71,7 @@ ifdef(`i386',
 0001001{w},{mod}{reg}{r_m}:adc {mod}{r_m}{w},{reg}{w}
 0000010{w},{imm}:add {imm}{w},{ax}{w}
 1000000{w},{mod}000{r_m},{imm}:add{w} {imm}{w},{mod}{r_m}{w}
-10000011,{mod}000{r_m},{imms8}:add{w0} {imms8},{mod}{r_m}
+10000011,{mod}000{r_m},{imms8}:add{w} {imms8},{mod}{r_m}
 0000000{w},{mod}{reg}{r_m}:add {reg}{w},{mod}{r_m}{w}
 0000001{w},{mod}{reg}{r_m}:add {mod}{r_m}{w},{reg}{w}
 01100110,00001111,11010000,{Mod}{xmmreg}{R_m}:addsubpd {Mod}{R_m},{xmmreg}
@@ -124,7 +124,7 @@ ifdef(`i386',
 00001111,0100{tttn},{mod}{reg}{r_m}:cmov{tttn} {mod}{r_m},{reg}
 0011110{w},{imm}:cmp {imm}{w},{ax}{w}
 1000000{w},{mod}111{r_m},{imm}:cmp{w} {imm}{w},{mod}{r_m}{w}
-10000011,{mod}111{r_m},{imms8}:cmp{w0} {imms8},{mod}{r_m}
+10000011,{mod}111{r_m},{imms8}:cmp{w} {imms8},{mod}{r_m}
 0011100{w},{mod}{reg}{r_m}:cmp {reg}{w},{mod}{r_m}{w}
 0011101{w},{mod}{reg}{r_m}:cmp {mod}{r_m}{w},{reg}{w}
 ifdef(`ASSEMBLER',
@@ -429,7 +429,7 @@ ifdef(`i386',
 0000100{w},{mod}{reg}{r_m}:or {reg}{w},{mod}{r_m}{w}
 0000101{w},{mod}{reg}{r_m}:or {mod}{r_m}{w},{reg}{w}
 1000000{w},{mod}001{r_m},{imm}:or{w} {imm}{w},{mod}{r_m}{w}
-1000001{w},{mod}001{r_m},{imm8}:or{w} {imm8},{mod}{r_m}{w}
+1000001{w},{mod}001{r_m},{imms8}:or{w} {imms8},{mod}{r_m}{w}
 0000110{w},{imm}:or {imm}{w},{ax}{w}
 1110011{w},{imm8}:out {ax}{w},{imm8}
 1110111{w}:out {ax}{w},{dx}
index 94bb84bf8941e1885f317f7a52142cc98d982474..7815dbc2f04f150c5c267426f8462deadc6258e3 100644 (file)
@@ -813,8 +813,15 @@ FCT_imms8 (struct output_data *d)
   if (*d->param_start >= d->end)
     return -1;
   int_fast8_t byte = *(*d->param_start)++;
-  int needed = snprintf (&d->bufp[*bufcntp], avail, "$0x%" PRIx32,
-                        (int32_t) byte);
+  int needed;
+#ifdef X86_64
+  if (*d->prefixes & has_rex_w)
+    needed = snprintf (&d->bufp[*bufcntp], avail, "$0x%" PRIx64,
+                      (int64_t) byte);
+  else
+#endif
+    needed = snprintf (&d->bufp[*bufcntp], avail, "$0x%" PRIx32,
+                      (int32_t) byte);
   if ((size_t) needed > avail)
     return (size_t) needed - avail;
   *bufcntp += needed;
index 0f3a01d47f6bd5e242cb99ca1029e3959ca87988..acd2d44308b0a7ba08935e9aae275ebe00738566 100644 (file)
@@ -640,6 +640,10 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr,
                            {
                              if (prefixes & has_data16)
                                ch = 'w';
+#ifdef X86_64
+                             else if (prefixes & has_rex_w)
+                               ch = 'q';
+#endif
                              else
                                ch = 'l';
                            }
index 64faabd355844b94c057b6267999f9daacdb5cee..458acd1509f0601425dbf0a80ff4b1dfb7ccfa7e 100644 (file)
@@ -1,3 +1,8 @@
+2008-01-10  Ulrich Drepper  <drepper@redhat.com>
+
+       * testfile45.S.bz2: Add more tests.
+       * testfile45.expect.bz2: Adjust.
+
 2008-01-08  Ulrich Drepper  <drepper@redhat.com>
 
        * Makefile.am (TESTS): Add run-disasm-x86-64.sh.
index a2012edbc31a2b3fe788dfa0c4713a91f0417dca..2fc2128986ac56a6e9015e2eb9f2b02fb98ce162 100644 (file)
Binary files a/tests/testfile45.S.bz2 and b/tests/testfile45.S.bz2 differ
index ac814e31a7d8b72a004f1843486f3857fd6b9d38..cb054b63c981afa3698479b52077dbba0b4facd8 100644 (file)
Binary files a/tests/testfile45.expect.bz2 and b/tests/testfile45.expect.bz2 differ