forked from Imagelibrary/binutils-gdb
x86: Ignore CS/DS/ES/SS segment-override prefixes in 64-bit mode
"In 64-bit mode, the CS, DS, ES, and SS segment-override prefixes have no effect. These four prefixes are not treated as segment-override prefixes for the purposes of multiple-prefix rules. Instead, they are treated as null prefixes." (AMD APM v2). However, objdump disassembles instructions containing those ignored prefixes by still generating that segment override: 66 66 2e 0f 1f 84 00 data16 nopw %cs:0x0(%rax,%rax,1) 00 00 00 00 Print those segment override prefixes as excessive ones: 66 66 2e 0f 1f 84 00 data16 cs nopw 0x0(%rax,%rax,1) 00 00 00 00 which is what they actually are - they have no effect and the decoding hardware ignores them. gas/ 2020-11-14 Borislav Petkov <bp@suse.de> * testsuite/gas/i386/x86-64-segovr.d: Adjust regexes. * testsuite/gas/i386/x86-64-nops.d: Likewise. * testsuite/gas/i386/x86-64-nops-1.d: Likewise. * testsuite/gas/i386/x86-64-nops-1-g64.d: Likewise. * testsuite/gas/i386/x86-64-nops-1-core2.d: Likewise. * testsuite/gas/i386/x86-64-nops-1-k8.d: Likewise. * testsuite/gas/i386/x86-64-nops-2.d: Likewise. * testsuite/gas/i386/x86-64-nops-3.d: Likewise. * testsuite/gas/i386/x86-64-nops-4.d: Likewise. * testsuite/gas/i386/x86-64-nops-4-core2.d: Likewise. * testsuite/gas/i386/x86-64-nops-4-k8.d: Likewise. * testsuite/gas/i386/x86-64-nops-5.d: Likewise. * testsuite/gas/i386/x86-64-nops-5-k8.d: Likewise. * testsuite/gas/i386/x86-64-nops-7.d: Likewise. * testsuite/gas/i386/x86-64-nop-1.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-1a.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-1b.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-1c.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-1d.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-1g.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-2c.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-6.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-7.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-8.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-nops-1-core2.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-nops-1-k8.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-nops-1.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-nops-2.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-nops-3.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-nops-4-core2.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-nops-4-k8.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-nops-4.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-nops-5-k8.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-nops-5.d: Likewise. * testsuite/gas/i386/ilp32/x86-64-nops.d:: Likewise. ld/ 2020-11-14 Borislav Petkov <bp@suse.de> * testsuite/ld-x86-64/pe-x86-64-4.od: Adjust regexes. * testsuite/ld-x86-64/tlsld3.dd: Likewise. * testsuite/ld-x86-64/tlsld4.dd: Likewise. opcodes/ 2020-11-14 Borislav Petkov <bp@suse.de> * i386-dis.c (ckprefix): Do not assign active_seg_prefix in 64-bit addressing mode. (NOTRACK_Fixup): Test prefixes for PREFIX_DS, instead of active_seg_prefix.
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
2020-11-14 Borislav Petkov <bp@suse.de>
|
||||
|
||||
* i386-dis.c (ckprefix): Do not assign active_seg_prefix in
|
||||
64-bit addressing mode.
|
||||
(NOTRACK_Fixup): Test prefixes for PREFIX_DS, instead of
|
||||
active_seg_prefix.
|
||||
|
||||
2020-11-11 Przemyslaw Wirkus <przemyslaw.wirkus@arm.com>
|
||||
|
||||
* aarch64-tbl.h: Enable -march=armv8.6-a+ls64.
|
||||
|
||||
@@ -9141,22 +9141,34 @@ ckprefix (void)
|
||||
case 0x2e:
|
||||
prefixes |= PREFIX_CS;
|
||||
last_seg_prefix = i;
|
||||
active_seg_prefix = PREFIX_CS;
|
||||
|
||||
if (address_mode != mode_64bit)
|
||||
active_seg_prefix = PREFIX_CS;
|
||||
|
||||
break;
|
||||
case 0x36:
|
||||
prefixes |= PREFIX_SS;
|
||||
last_seg_prefix = i;
|
||||
active_seg_prefix = PREFIX_SS;
|
||||
|
||||
if (address_mode != mode_64bit)
|
||||
active_seg_prefix = PREFIX_SS;
|
||||
|
||||
break;
|
||||
case 0x3e:
|
||||
prefixes |= PREFIX_DS;
|
||||
last_seg_prefix = i;
|
||||
active_seg_prefix = PREFIX_DS;
|
||||
|
||||
if (address_mode != mode_64bit)
|
||||
active_seg_prefix = PREFIX_DS;
|
||||
|
||||
break;
|
||||
case 0x26:
|
||||
prefixes |= PREFIX_ES;
|
||||
last_seg_prefix = i;
|
||||
active_seg_prefix = PREFIX_ES;
|
||||
|
||||
if (address_mode != mode_64bit)
|
||||
active_seg_prefix = PREFIX_ES;
|
||||
|
||||
break;
|
||||
case 0x64:
|
||||
prefixes |= PREFIX_FS;
|
||||
@@ -13656,7 +13668,10 @@ static void
|
||||
NOTRACK_Fixup (int bytemode ATTRIBUTE_UNUSED,
|
||||
int sizeflag ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (active_seg_prefix == PREFIX_DS
|
||||
|
||||
/* Since active_seg_prefix is not set in 64-bit mode, check whether
|
||||
we've seen a PREFIX_DS. */
|
||||
if ((prefixes & PREFIX_DS) != 0
|
||||
&& (address_mode != mode_64bit || last_data_prefix < 0))
|
||||
{
|
||||
/* NOTRACK prefix is only valid on indirect branch instructions.
|
||||
|
||||
Reference in New Issue
Block a user