From: "Rohr, Stephan" <stephan.rohr@intel.com>
To: Hannes Domani <ssbssa@yahoo.de>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: "Joos, Christina" <christina.joos@intel.com>,
Tom Tromey <tom@tromey.com>
Subject: RE: [PATCH v3 8/8] Windows gdb: Implement AVX-512 register support
Date: Tue, 8 Sep 2026 13:05:02 +0000 [thread overview]
Message-ID: <DS7PR11MB624710FBC67AE6DD994CC83993B12@DS7PR11MB6247.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20260829145823.1034821-8-ssbssa@yahoo.de>
Hi Hannes,
please see some inline feedback below.
Some of the feedback provided for
[PATCH v3 7/8] Windows gdb: Implement AVX register support
applies here as well.
Thanks
Stephan
> -----Original Message-----
> From: Hannes Domani <ssbssa@yahoo.de>
> Sent: Saturday, 29 August 2026 16:49
> To: gdb-patches@sourceware.org
> Subject: [PATCH v3 8/8] Windows gdb: Implement AVX-512 register support
>
> This adds support for the Intel AVX-512 registers on Windows.
> It enables accessing registers $ymm0 - $ymm31, $zmm0 - $zmm31, and
> $k0 - $k7 where they are available.
>
> After this patch gdb.arch/i386-avx512.exp passes on windows.
> ---
> v3:
> - merged gdb+gdbserver parts, and split again AVX/AVX-512 parts
> ---
> gdb/NEWS | 2 ++
> gdb/nat/windows-nat.c | 2 +-
> gdb/x86-windows-nat.c | 35 +++++++++++++++++++++++++++
> gdbserver/win32-i386-low.cc | 48
> ++++++++++++++++++++++++++++++++++++-
> 4 files changed, 85 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/NEWS b/gdb/NEWS
> index f7effc822e9..d3db6dd167e 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -120,6 +120,8 @@
>
> * Support for Intel AVX registers on Windows.
> Support displaying and modifying Intel AVX registers $ymm0 - $ymm31.
Following the previous patch, this should update again to registers $ymm0 - $ymm31?
> + Support displaying and modifying Intel AVX-512 registers $zmm0 - $zmm31
> + and $k0 - $k7.
>
> * Configure changes
>
> diff --git a/gdb/nat/windows-nat.c b/gdb/nat/windows-nat.c
> index c9a21d7c41f..30d49c07332 100644
> --- a/gdb/nat/windows-nat.c
> +++ b/gdb/nat/windows-nat.c
> @@ -1339,7 +1339,7 @@ initialize_loadable ()
> {
> /* Available XState features masked with implemented features. */
> xstate_features = (GetEnabledXStateFeatures ()
> - & X86_XSTATE_AVX_MASK);
> + & X86_XSTATE_AVX_AVX512_MASK);
> /* The extended XState functions are only needed if the available
> features exceed SSE. */
> if ((xstate_features & ~X86_XSTATE_SSE_MASK) == 0)
> diff --git a/gdb/x86-windows-nat.c b/gdb/x86-windows-nat.c
> index 1cefe6171be..425e343deca 100644
> --- a/gdb/x86-windows-nat.c
> +++ b/gdb/x86-windows-nat.c
> @@ -291,6 +291,41 @@ get_context_reg_ptr (Context *context, int r,
> i386_gdbarch_tdep *tdep)
> (context, X86_XSTATE_AVX_ID, NULL);
> context_offset += 16 * (r - I387_YMM0H_REGNUM (tdep));
> }
> + else if (I387_ZMM0H_REGNUM (tdep) > 0 && r >= I387_ZMM0H_REGNUM
> (tdep)
> + && r < I387_ZMM16H_REGNUM (tdep) && r <
> I387_ZMMENDH_REGNUM (tdep))
> + {
I basically have the same concern as in patch 7/8 regarding the guards on gdbserver
side but missing here.
> + context_offset = (char *) locate_xstate_feature
> + (context, X86_XSTATE_ZMM_H_ID, NULL);
> + context_offset += 32 * (r - I387_ZMM0H_REGNUM (tdep));
> + }
> + else if (I387_ZMM0H_REGNUM (tdep) > 0 && r >=
> I387_ZMM16H_REGNUM (tdep)
> + && r < I387_ZMMENDH_REGNUM (tdep))
> + {
> + context_offset = (char *) locate_xstate_feature
> + (context, X86_XSTATE_ZMM_ID, NULL);
> + context_offset += 32 + 64 * (r - I387_ZMM16H_REGNUM (tdep));
> + }
> + else if (I387_K0_REGNUM (tdep) > 0 && r >= I387_K0_REGNUM (tdep)
> + && r < I387_KEND_REGNUM (tdep))
> + {
> + context_offset = (char *) locate_xstate_feature
> + (context, X86_XSTATE_K_ID, NULL);
> + context_offset += 8 * (r - I387_K0_REGNUM (tdep));
> + }
> + else if (I387_YMM16H_REGNUM (tdep) > 0 && r >=
> I387_YMM16H_REGNUM (tdep)
> + && r < I387_YMMH_AVX512_END_REGNUM (tdep))
> + {
> + context_offset = (char *) locate_xstate_feature
> + (context, X86_XSTATE_ZMM_ID, NULL);
> + context_offset += 16 + 64 * (r - I387_YMM16H_REGNUM (tdep));
> + }
> + else if (I387_XMM16_REGNUM (tdep) > 0 && r >= I387_XMM16_REGNUM
> (tdep)
> + && r < I387_XMM_AVX512_END_REGNUM (tdep))
> + {
> + context_offset = (char *) locate_xstate_feature
> + (context, X86_XSTATE_ZMM_ID, NULL);
> + context_offset += 64 * (r - I387_XMM16_REGNUM (tdep));
> + }
> else
> gdb_assert_not_reached ("invalid register number %d", r);
>
> diff --git a/gdbserver/win32-i386-low.cc b/gdbserver/win32-i386-low.cc
> index a7e83c0239c..6911587f977 100644
> --- a/gdbserver/win32-i386-low.cc
> +++ b/gdbserver/win32-i386-low.cc
> @@ -529,8 +529,11 @@ get_context_reg_ptr (Context *context, int r, const
> target_desc *tdesc)
> }
>
> bool amd64 = register_size (tdesc, 0) == 8;
> - int ymm0h_regnum;
> + int ymm0h_regnum, zmm0h_regnum, k0_regnum;
> + int xmm16_regnum, ymm16h_regnum, zmm16h_regnum;
> const int num_xmm_registers = amd64 ? 16 : 8;
> + const int num_zmm_high_registers = amd64 ? 16 : 0;
> + const int num_avx512_k_registers = 8;
>
> char *context_offset;
> if (r < mappings_count)
> @@ -543,6 +546,49 @@ get_context_reg_ptr (Context *context, int r, const
> target_desc *tdesc)
> (context, X86_XSTATE_AVX_ID, NULL);
> context_offset += 16 * (r - ymm0h_regnum);
> }
> + else if ((xstate_features & X86_XSTATE_ZMM_H) != 0
> + && r >= (zmm0h_regnum = find_regno (tdesc, "zmm0h"))
> + && r < zmm0h_regnum + num_xmm_registers)
> + {
> + context_offset = (char *) locate_xstate_feature
> + (context, X86_XSTATE_ZMM_H_ID, NULL);
> + context_offset += 32 * (r - zmm0h_regnum);
> + }
> + else if ((xstate_features & X86_XSTATE_ZMM) != 0
> + && num_zmm_high_registers != 0
> + && r >= (zmm16h_regnum = find_regno (tdesc, "zmm16h"))
> + && r < zmm16h_regnum + num_zmm_high_registers)
> + {
> + context_offset = (char *) locate_xstate_feature
> + (context, X86_XSTATE_ZMM_ID, NULL);
> + context_offset += 32 + 64 * (r - zmm16h_regnum);
> + }
> + else if ((xstate_features & X86_XSTATE_K) != 0
> + && r >= (k0_regnum = find_regno (tdesc, "k0"))
> + && r < k0_regnum + num_avx512_k_registers)
> + {
> + context_offset = (char *) locate_xstate_feature
> + (context, X86_XSTATE_K_ID, NULL);
> + context_offset += 8 * (r - k0_regnum);
> + }
> + else if ((xstate_features & X86_XSTATE_ZMM) != 0
> + && num_zmm_high_registers != 0
> + && r >= (ymm16h_regnum = find_regno (tdesc, "ymm16h"))
> + && r < ymm16h_regnum + num_zmm_high_registers)
> + {
> + context_offset = (char *) locate_xstate_feature
> + (context, X86_XSTATE_ZMM_ID, NULL);
> + context_offset += 16 + 64 * (r - ymm16h_regnum);
> + }
> + else if ((xstate_features & X86_XSTATE_ZMM) != 0
> + && num_zmm_high_registers != 0
> + && r >= (xmm16_regnum = find_regno (tdesc, "xmm16"))
> + && r < xmm16_regnum + num_zmm_high_registers)
> + {
> + context_offset = (char *) locate_xstate_feature
> + (context, X86_XSTATE_ZMM_ID, NULL);
> + context_offset += 64 * (r - xmm16_regnum);
> + }
> else
> gdb_assert_not_reached ("invalid register number %d", r);
>
These are a lot of look-ups on gdbserver side. Each "find_regno" iterates over
the complete set of registers and does string comparison. It would be nice to
implement this like the GDB side and cache the register numbers.
I think it is not mandatory to implement this but would be nice to have.
> --
> 2.54.0
________________________________________
Intel Deutschland GmbH
Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany
Tel: +49 (89) 99143-0
www.intel.de
Managing Directors: Candice Moore, Jeffrey Schneiderman, Ramachandran Sitaraman
Chairperson of the Supervisory Board: Sonja Pierer
Registered Seat: Munich Commercial Register B: Amtsgericht Munich HRB 186928
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
next prev parent reply other threads:[~2026-09-08 13:05 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260829145823.1034821-1-ssbssa.ref@yahoo.de>
2026-08-29 14:48 ` [PATCH v3 1/8] gdb/testsuite: Add Windows replacement for aligned_alloc Hannes Domani
2026-08-29 14:48 ` [PATCH v3 2/8] Windows gdb: Use allocated buffer for CONTEXT Hannes Domani
2026-09-01 17:22 ` Tom Tromey
2026-09-01 17:30 ` Hannes Domani
2026-08-29 14:49 ` [PATCH v3 3/8] Windows gdb: Remove mappings member from windows_per_inferior Hannes Domani
2026-08-29 14:49 ` [PATCH v3 4/8] Windows gdb: Refactor getting pointer to register inside context Hannes Domani
2026-08-29 14:49 ` [PATCH v3 5/8] Windows gdb: Prepare XState functions Hannes Domani
2026-08-29 14:49 ` [PATCH v3 6/8] Windows gdb: Get available XState features Hannes Domani
2026-09-01 17:38 ` Tom Tromey
2026-09-01 17:44 ` Hannes Domani
2026-09-01 17:51 ` Tom Tromey
2026-08-29 14:49 ` [PATCH v3 7/8] Windows gdb: Implement AVX register support Hannes Domani
2026-09-01 17:48 ` Tom Tromey
2026-09-01 18:00 ` Hannes Domani
2026-09-08 15:27 ` Joos, Christina
2026-09-04 16:33 ` Joos, Christina
2026-09-08 13:04 ` Rohr, Stephan
2026-09-10 11:33 ` Joos, Christina
2026-08-29 14:49 ` [PATCH v3 8/8] Windows gdb: Implement AVX-512 " Hannes Domani
2026-08-29 15:40 ` Eli Zaretskii
2026-09-01 17:49 ` Tom Tromey
2026-09-08 13:05 ` Rohr, Stephan [this message]
2026-09-10 12:08 ` Joos, Christina
2026-09-10 14:39 ` Hannes Domani
2026-09-13 21:18 ` Joos, Christina
2026-09-10 16:54 ` Hannes Domani
2026-09-13 21:37 ` Joos, 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=DS7PR11MB624710FBC67AE6DD994CC83993B12@DS7PR11MB6247.namprd11.prod.outlook.com \
--to=stephan.rohr@intel.com \
--cc=christina.joos@intel.com \
--cc=gdb-patches@sourceware.org \
--cc=ssbssa@yahoo.de \
--cc=tom@tromey.com \
/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