aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2020-11-28 14:20:06 +0100
committerH.J. Lu <hjl.tools@gmail.com>2020-11-29 09:08:56 -0800
commit632ee6fd822f8264edc5935c4e31955849df8ba2 (patch)
treecb5f6b5f3ea89bbab67eaf48ecb4b965832e5f8a /opcodes
parent568cbddc710f6cb6be752f390a1521cd5556ad9b (diff)
downloadgdb-632ee6fd822f8264edc5935c4e31955849df8ba2.zip
gdb-632ee6fd822f8264edc5935c4e31955849df8ba2.tar.gz
gdb-632ee6fd822f8264edc5935c4e31955849df8ba2.tar.bz2
x86: Do not dump DS/CS segment overrides for branch hints
The previous change "x86: Ignore CS/DS/ES/SS segment-override prefixes in 64-bit mode" to ignore segment override prefixes in 64-bit mode lead to dumping branch hints as excessive prefixes: ffffffff8109d5a0 <vmx_get_rflags>: ... ffffffff8109d601: 3e 77 0a ds ja,pt ffffffff8109d60e <vmx_get_rflags+0x6e> ^^^^^ In this particular case, those prefixes are not excessive but are used to provide branch hints - taken/not-taken - to the CPU. Assign active_seg_prefix in that particular case to consume them. gas/ 2002-11-29 Borislav Petkov <bp@suse.de> * testsuite/gas/i386/branch.d: Add new branch insns test. * testsuite/gas/i386/branch.s: Likewise. * testsuite/gas/i386/i386.exp: Insert the new branch test. * testsuite/gas/i386/x86-64-branch.d: Test for branch hints insns. * testsuite/gas/i386/x86-64-branch.s: Likewise. * testsuite/gas/i386/ilp32/x86-64-branch.d: Likewise. opcodes/ 2020-11-28 Borislav Petkov <bp@suse.de> * i386-dis.c (print_insn): Set active_seg_prefix for branch hint insns to not dump branch hint prefixes 0x2E and 0x3E as unused prefixes.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog5
-rw-r--r--opcodes/i386-dis.c13
2 files changed, 16 insertions, 2 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 1e7e40f..02fd2f5 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,8 @@
+2020-11-28 Borislav Petkov <bp@suse.de>
+
+ * i386-dis.c (print_insn): Set active_seg_prefix for branch hint insns
+ to not dump branch hint prefixes 0x2E and 0x3E as unused prefixes.
+
2020-11-16 Przemyslaw Wirkus <przemyslaw.wirkus@arm.com>
* aarch64-tbl.h (FLAGM): Handle for FLAGM feature.
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c
index 58cf001..a1e47c5 100644
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -10910,10 +10910,19 @@ putop (const char *in_template, int sizeflag)
used_prefixes |= prefixes & (PREFIX_CS | PREFIX_DS);
*obufp++ = ',';
*obufp++ = 'p';
+
+ /* Set active_seg_prefix even if not set in 64-bit mode
+ because here it is a valid branch hint. */
if (prefixes & PREFIX_DS)
- *obufp++ = 't';
+ {
+ active_seg_prefix = PREFIX_DS;
+ *obufp++ = 't';
+ }
else
- *obufp++ = 'n';
+ {
+ active_seg_prefix = PREFIX_CS;
+ *obufp++ = 'n';
+ }
}
break;
case 'K':