Re: [PATCH 1/1] gdb, gdbserver: Add Intel APX register support
Eli Zaretskii <[email protected]> Sat, 25 Jul 2026 14:07:41 +0300
| Newsgroups | gmane.comp.gdb.patches |
|---|---|
| Message-ID | <[email protected]> |
> From: Christina Joos <[email protected]> > Cc: [email protected] > Date: Sat, 25 Jul 2026 10:53:35 +0000 > > From: "H.J. Lu" <[email protected]> > > Intel Advanced Performance Extensions (APX) doubles the number of > general-purpose registers (GPRs) from 16 to 32 (r16-r31). > > Those new 64-bit Extended GPRs (EGPRs) do not change the size of the > XSAVE area, as they take up the space left behind by the deprecated > MPX registers. > > In contrast to the legacy GPRS, EGPRs are not enabled by default in 64-bit > mode but are xcr0 enabled based on APX_F Intel APX state. Define > X86_XSTATE_APX_F to support this new configuration. > > Add gdb and gdbserver registers support for those new 64-bit EGPRs. > Also add byte, word and dword pseudo register support. > > Co-Authored-By: Christina Joos <[email protected]> > --- > gdb/NEWS | 4 + > gdb/amd64-linux-tdep.c | 2 + > gdb/amd64-tdep.c | 262 ++++++++++++++---- > gdb/amd64-tdep.h | 2 + > gdb/arch/amd64.c | 4 + > gdb/arch/x86-linux-tdesc-features.c | 1 + > gdb/doc/gdb.texinfo | 5 + > gdb/features/Makefile | 1 + > gdb/features/i386/64bit-apx.c | 29 ++ > gdb/features/i386/64bit-apx.xml | 26 ++ > gdb/i386-tdep.c | 32 ++- > gdb/i386-tdep.h | 26 ++ > gdb/i387-tdep.c | 105 ++++++- > gdb/i387-tdep.h | 6 + > gdb/nat/x86-xstate.c | 1 + > gdb/target-debug.h | 1 + > gdb/testsuite/gdb.arch/amd64-apx-core.c | 88 ++++++ > gdb/testsuite/gdb.arch/amd64-apx-corefile.c | 71 +++++ > gdb/testsuite/gdb.arch/amd64-apx-corefile.exp | 67 +++++ > gdb/testsuite/gdb.arch/amd64-apx.c | 66 +++++ > gdb/testsuite/gdb.arch/amd64-apx.exp | 77 +++++ > gdb/testsuite/lib/gdb.exp | 58 ++++ > gdbserver/i387-fp.cc | 43 +++ > gdbserver/linux-x86-low.cc | 4 +- > gdbsupport/x86-xstate.h | 12 +- > 25 files changed, 931 insertions(+), 62 deletions(-) > create mode 100644 gdb/features/i386/64bit-apx.c > create mode 100644 gdb/features/i386/64bit-apx.xml > create mode 100644 gdb/testsuite/gdb.arch/amd64-apx-core.c > create mode 100644 gdb/testsuite/gdb.arch/amd64-apx-corefile.c > create mode 100644 gdb/testsuite/gdb.arch/amd64-apx-corefile.exp > create mode 100644 gdb/testsuite/gdb.arch/amd64-apx.c > create mode 100644 gdb/testsuite/gdb.arch/amd64-apx.exp Thanks. > diff --git a/gdb/NEWS b/gdb/NEWS > index 8f40ca5cb11..5b3ba152188 100644 > --- a/gdb/NEWS > +++ b/gdb/NEWS > @@ -3,6 +3,10 @@ > > *** Changes since GDB 17 > > +* Support for Intel APX registers on amd64 GNU/Linux. > + Support displaying and modifying Intel APX registers (Extended GPRs > + $r16 - $r31) including byte, word and dword pseudo registers. > + > * Support for the Common Trace Format (CTF) has been removed. GDB now > saves trace information exclusively in its own "tfile" format. This part is okay. > diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo > index 0030698dcee..69a2d714299 100644 > --- a/gdb/doc/gdb.texinfo > +++ b/gdb/doc/gdb.texinfo > @@ -50753,6 +50753,11 @@ amd64, 32 bits on amd64 with 32-bit pointer size (X32) and 32 bits on i386. > Following the restriction of the Linux kernel, only @value{GDBN} for amd64 > targets makes use of this feature for now. > > +The @samp{org.gnu.gdb.i386.apx} feature is optional. It should describe > +16 Extended General Purpose registers (@acronym{EGPRs}) > +@samp{r16} - @samp{r31} with 64 bits each. All @acronym{Intel APX} > +registers are valid only on amd64. This is also OK, but please use @acronym only for "APX", leaving the "Intel" part outside of it. Reviewed-By: Eli Zaretskii <[email protected]>