Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: "Gerlicher, Klaus" <klaus.gerlicher@intel.com>,
	Sam James <sam@gentoo.org>, "Beulich, Jan" <JBeulich@suse.com>
Cc: "Jiang, Haochen" <haochen.jiang@intel.com>,
	Binutils <binutils@sourceware.org>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	"H.J.Lu" <hjl.tools@gmail.com>,
	Alexander Monakov <amonakov@ispras.ru>
Subject: Re: Inconsistent usage on onebyte_modrm and twobyte_modrm table in x86 disassembler and gdb?
Date: Tue, 26 Aug 2025 11:31:51 +0200	[thread overview]
Message-ID: <23021f8f-e769-4160-8689-24b9d38b61b6@suse.de> (raw)
In-Reply-To: <DM3PPFD7E67F03693D5CCD247A707920DF8E839A@DM3PPFD7E67F036.namprd11.prod.outlook.com>

On 8/26/25 10:19, Gerlicher, Klaus wrote:
> FWIW I'll attach my fix for the (V)PBLENDW. It has a testcase and a unittest case.

Hi Klaus,

thanks for working on this.

The patch LGTM, other than this:
...
$ git show --pretty=%s --check
Fix vpblendw

gdb/amd64-tdep.c:1409: space before tab in indent.
+      	  need_modrm = 1;
...

I've tested both the unit test, and the updated test-case.

I've also tested the unit test I wrote, which uses vex3 instead of evex:
...
+
+  /* INSN: vpblendw $0x7,%xmm4,%xmm6,%xmm2, vex3 prefix.  */
+  insn = { 0xc4, 0xe3, 0x49, 0x0e, 0xd4, 0x07 };
+  amd64_get_insn_details (insn.data (), &details);
+  SELF_CHECK (details.opcode_len == 3);
+  SELF_CHECK (details.enc_prefix_offset == 0);
+  SELF_CHECK (details.opcode_offset == 3);
+  SELF_CHECK (details.modrm_offset == 4);
+
+  /* INSN: vpblendw $0x7,0xff(%rip),%ymm6,%ymm2, vex3 prefix.  */
+  insn = { 0xc4, 0xe3, 0x4d, 0x0e, 0x15, 0xff, 0x00, 0x00, 0x00, 0x07 };
+  amd64_get_insn_details (insn.data (), &details);
+  SELF_CHECK (details.opcode_len == 3);
+  SELF_CHECK (details.enc_prefix_offset == 0);
+  SELF_CHECK (details.opcode_offset == 3);
+  SELF_CHECK (details.modrm_offset == 4);
+
+  /* INSN: vpblendw $0x7,0xff(%ecx),%ymm6,%ymm2, vex3 prefix.  */
+  fixup_riprel (details, insn.data (), ECX_REG_NUM);
+  updated_insn
+    = { 0xc4, 0xe3, 0x4d, 0x0e, 0x91, 0xff, 0x00, 0x00, 0x00, 0x07 };
+  SELF_CHECK (insn == updated_insn);
...

You could add this as well, but it's not required.

[ Note that you could drop the test-case update and use fixup_riprel on 
the unit test you added instead, like I did here and is done elsewhere 
in the unit test. ]

Please commit this with some appropriate $subject.

Approved-By: Tom de Vries <tdevries@suse.de>

Thanks,
- Tom

  reply	other threads:[~2025-08-26  9:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <SJ5PPF77D28E3C228C975969E2B0BDB2853EC3EA@SJ5PPF77D28E3C2.namprd11.prod.outlook.com>
     [not found] ` <92aea037-9c0e-438f-8a0a-fd52dd2df7bc@suse.com>
2025-08-25  8:45   ` Sam James
2025-08-25  9:26     ` Alexander Monakov
2025-08-25 14:33       ` Tom de Vries
2025-08-26  6:02         ` Jiang, Haochen
2025-08-26  8:19     ` Gerlicher, Klaus
2025-08-26  9:31       ` Tom de Vries [this message]
2025-08-27 10:32         ` Schimpe, Christina
2025-08-27 12:20           ` Jan Beulich
2025-08-27 15:23             ` Schimpe, Christina

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=23021f8f-e769-4160-8689-24b9d38b61b6@suse.de \
    --to=tdevries@suse.de \
    --cc=JBeulich@suse.com \
    --cc=amonakov@ispras.ru \
    --cc=binutils@sourceware.org \
    --cc=gdb-patches@sourceware.org \
    --cc=haochen.jiang@intel.com \
    --cc=hjl.tools@gmail.com \
    --cc=klaus.gerlicher@intel.com \
    --cc=sam@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox