summaryrefslogtreecommitdiff
path: root/libcpu
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-12-31 10:21:51 -0800
committerUlrich Drepper <drepper@redhat.com>2008-12-31 10:21:51 -0800
commit54a6d4b1b6828519ea707f2ce4d8c1829c9fe595 (patch)
treeaa59bd9fb4fdde90c792e5f5527f839fdb210947 /libcpu
parent98c245eb57b7a95b8673031cb8562b36716a04f4 (diff)
downloadelfutils-54a6d4b1b6828519ea707f2ce4d8c1829c9fe595.tar.gz
Fix printing of rex prefix in x86-64 disassembler.
Diffstat (limited to 'libcpu')
-rw-r--r--libcpu/ChangeLog3
-rw-r--r--libcpu/i386_disasm.c17
2 files changed, 20 insertions, 0 deletions
diff --git a/libcpu/ChangeLog b/libcpu/ChangeLog
index 041123e1..c562ff54 100644
--- a/libcpu/ChangeLog
+++ b/libcpu/ChangeLog
@@ -1,5 +1,8 @@
2008-12-31 Ulrich Drepper <drepper@redhat.com>
+ * i386_disasm.c [X86_64] (i386_disasm): Handle rex prefix when
+ printing only prefix.
+
* i386_disasm.c (i386_disasm): Minor optimizations.
* i386_parse.y (instrtable_out): No need to emit index, the reader can
diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c
index 9961e4d9..b99748b6 100644
--- a/libcpu/i386_disasm.c
+++ b/libcpu/i386_disasm.c
@@ -520,6 +520,23 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr,
case prefix_lock:
ADD_STRING ("lock");
break;
+#ifdef X86_64
+ case 0x40 ... 0x4f:
+ ADD_STRING ("rex");
+ if (byte != 0x40)
+ {
+ ADD_CHAR ('.');
+ if (byte & 0x8)
+ ADD_CHAR ('w');
+ if (byte & 0x4)
+ ADD_CHAR ('r');
+ if (byte & 0x3)
+ ADD_CHAR ('x');
+ if (byte & 0x1)
+ ADD_CHAR ('b');
+ }
+ break;
+#endif
default:
/* Cannot happen. */
puts ("unknown prefix");