x86/APX: GETSEC cannot be used with REX2

Message ID 6842b4da-231f-4cf8-b0a2-4b3d0611503c@suse.com
State New
Headers
Series x86/APX: GETSEC cannot be used with REX2 |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed

Commit Message

Jan Beulich Jan. 24, 2025, 11:12 a.m. UTC
  It lives in a "forbidden" row, yet its disassembler table entry was
lacking a respective marker.
  

Comments

Cui, Lili Jan. 26, 2025, 2:37 a.m. UTC | #1
> -----Original Message-----
> From: Jan Beulich <jbeulich@suse.com>
> Sent: Friday, January 24, 2025 7:12 PM
> To: Binutils <binutils@sourceware.org>
> Cc: Cui, Lili <lili.cui@intel.com>; H.J. Lu <hjl.tools@gmail.com>
> Subject: [PATCH] x86/APX: GETSEC cannot be used with REX2
> 
> It lives in a "forbidden" row, yet its disassembler table entry was lacking a
> respective marker.
> 
> --- a/opcodes/i386-dis.c
> +++ b/opcodes/i386-dis.c
> @@ -2305,7 +2305,7 @@ static const struct dis386 dis386_twobyt
>    { "sysenter",		{ SEP }, PREFIX_REX2_ILLEGAL },
>    { "sysexit%LQ",	{ SEP }, PREFIX_REX2_ILLEGAL },
>    { Bad_Opcode },
> -  { "getsec",		{ XX }, 0 },
> +  { "getsec",		{ XX }, PREFIX_REX2_ILLEGAL },

Yes, it seems I forgot to add PREFIX_REX2_ILLEGAL for these instructions.

• All opcodes listed below are reserved under REX2 and triggers #UD when prefixed with REX2:
– Legacy map 0:
* All opcodes in the row 0x4*
* All opcodes in the row 0x7*
* All opcodes in the row 0xA*
· Exception: 0xA1 prefixed by REX2 is used to encode the JMPABS instruction
(Section 3.1.3.3)
* All opcodes in the row 0xE*
– Legacy map 1:
* All opcodes in row 0x3*
* All opcodes in row 0x8*

Lili.

>    /* 38 */
>    { THREE_BYTE_TABLE (THREE_BYTE_0F38) },
>    { Bad_Opcode },
  

Patch

--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -2305,7 +2305,7 @@  static const struct dis386 dis386_twobyt
   { "sysenter",		{ SEP }, PREFIX_REX2_ILLEGAL },
   { "sysexit%LQ",	{ SEP }, PREFIX_REX2_ILLEGAL },
   { Bad_Opcode },
-  { "getsec",		{ XX }, 0 },
+  { "getsec",		{ XX }, PREFIX_REX2_ILLEGAL },
   /* 38 */
   { THREE_BYTE_TABLE (THREE_BYTE_0F38) },
   { Bad_Opcode },