From: "H.J. Lu" <hjl.tools@gmail.com>
To: GDB <gdb-patches@sourceware.org>, Binutils <binutils@sourceware.org>
Subject: Re: PATCH [1/n]: Support AVX core dump
Date: Tue, 02 Feb 2010 05:56:00 -0000 [thread overview]
Message-ID: <6dc9ffc81002012155j6f2ee40od330de7d0073c5ce@mail.gmail.com> (raw)
In-Reply-To: <6dc9ffc81002011830l20bd018aoae6971f633ed0a02@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 946 bytes --]
On Mon, Feb 1, 2010 at 6:30 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> Hi,
>
> Here is the first patch to support AVX core dump and debug. OK to install?
>
> Thanks.
>
>
> H.J.
> ---
>
> bfd/
>
> 2010-01-27 H.J. Lu <hongjiu.lu@intel.com>
>
> * elf-bfd.h (elfcore_write_xstatereg): New.
>
> * elf.c (elfcore_grok_xstatereg): New.
> (elfcore_write_xstatereg): Likewise.
> (elfcore_grok_note): Handle NT_X86_XSTATE.
> (elfcore_write_register_note): Handle .reg-xstate section.
>
> binutils/
>
> 2010-01-27 H.J. Lu <hongjiu.lu@intel.com>
>
> * readelf.c (get_note_type): Handle NT_X86_XSTATE.
>
> include/elf/
>
> 2010-01-27 H.J. Lu <hongjiu.lu@intel.com>
>
> * common.h (NT_386_XSTATE): New.
>
>
Hi,
The AVX debug support has been checked into kernel. I'd like to check in this
binutils support. Full gdb patch will come later.
Thanks.
--
H.J.
[-- Attachment #2: binutils-xsave-1.patch --]
[-- Type: text/plain, Size: 3986 bytes --]
bfd/
2010-01-27 H.J. Lu <hongjiu.lu@intel.com>
* elf-bfd.h (elfcore_write_xstatereg): New.
* elf.c (elfcore_grok_xstatereg): New.
(elfcore_write_xstatereg): Likewise.
(elfcore_grok_note): Handle NT_X86_XSTATE.
(elfcore_write_register_note): Handle .reg-xstate section.
binutils/
2010-01-27 H.J. Lu <hongjiu.lu@intel.com>
* readelf.c (get_note_type): Handle NT_X86_XSTATE.
include/elf/
2010-01-27 H.J. Lu <hongjiu.lu@intel.com>
* common.h (NT_386_XSTATE): New.
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index daa2b62..3c3ac9b 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -2149,6 +2149,8 @@ extern char *elfcore_write_prfpreg
(bfd *, char *, int *, const void *, int);
extern char *elfcore_write_prxfpreg
(bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_xstatereg
+ (bfd *, char *, int *, const void *, int);
extern char *elfcore_write_ppc_vmx
(bfd *, char *, int *, const void *, int);
extern char *elfcore_write_ppc_vsx
diff --git a/bfd/elf.c b/bfd/elf.c
index aac3314..4fff4a7 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -7628,6 +7628,16 @@ elfcore_grok_prxfpreg (bfd *abfd, Elf_Internal_Note *note)
return elfcore_make_note_pseudosection (abfd, ".reg-xfp", note);
}
+/* Linux dumps the Intel XSAVE extended state in a note named "LINUX"
+ with a note type of NT_X86_XSTATE. Just include the whole note's
+ contents literally. */
+
+static bfd_boolean
+elfcore_grok_xstatereg (bfd *abfd, Elf_Internal_Note *note)
+{
+ return elfcore_make_note_pseudosection (abfd, ".reg-xstate", note);
+}
+
static bfd_boolean
elfcore_grok_ppc_vmx (bfd *abfd, Elf_Internal_Note *note)
{
@@ -7993,6 +8003,13 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note)
else
return TRUE;
+ case NT_X86_XSTATE: /* Linux XSAVE extension */
+ if (note->namesz == 6
+ && strcmp (note->namedata, "LINUX") == 0)
+ return elfcore_grok_xstatereg (abfd, note);
+ else
+ return TRUE;
+
case NT_PPC_VMX:
if (note->namesz == 6
&& strcmp (note->namedata, "LINUX") == 0)
@@ -8633,6 +8650,15 @@ elfcore_write_prxfpreg (bfd *abfd,
}
char *
+elfcore_write_xstatereg (bfd *abfd, char *buf, int *bufsiz,
+ const void *xfpregs, int size)
+{
+ char *note_name = "LINUX";
+ return elfcore_write_note (abfd, buf, bufsiz,
+ note_name, NT_X86_XSTATE, xfpregs, size);
+}
+
+char *
elfcore_write_ppc_vmx (bfd *abfd,
char *buf,
int *bufsiz,
@@ -8681,6 +8707,8 @@ elfcore_write_register_note (bfd *abfd,
return elfcore_write_prfpreg (abfd, buf, bufsiz, data, size);
if (strcmp (section, ".reg-xfp") == 0)
return elfcore_write_prxfpreg (abfd, buf, bufsiz, data, size);
+ if (strcmp (section, ".reg-xstate") == 0)
+ return elfcore_write_xstatereg (abfd, buf, bufsiz, data, size);
if (strcmp (section, ".reg-ppc-vmx") == 0)
return elfcore_write_ppc_vmx (abfd, buf, bufsiz, data, size);
if (strcmp (section, ".reg-ppc-vsx") == 0)
diff --git a/binutils/readelf.c b/binutils/readelf.c
index b9de73a..34dbfac 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -10415,6 +10415,8 @@ get_note_type (unsigned e_type)
return _("NT_PPC_VMX (ppc Altivec registers)");
case NT_PPC_VSX:
return _("NT_PPC_VSX (ppc VSX registers)");
+ case NT_X86_XSTATE:
+ return _("NT_X86_XSTATE (x86 XSAVE extended state)");
case NT_S390_HIGH_GPRS:
return _("NT_S390_HIGH_GPRS (s390 upper register halves)");
case NT_PSTATUS:
diff --git a/include/elf/common.h b/include/elf/common.h
index 703916e..a762902 100644
--- a/include/elf/common.h
+++ b/include/elf/common.h
@@ -513,6 +513,8 @@
/* note name must be "LINUX". */
#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */
/* note name must be "LINUX". */
+#define NT_X86_XSTATE 0x202 /* x86 XSAVE extended state */
+ /* note name must be "LINUX". */
#define NT_S390_HIGH_GPRS 0x300 /* S/390 upper halves of GPRs */
/* note name must be "LINUX". */
next prev parent reply other threads:[~2010-02-02 5:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-02 2:30 H.J. Lu
2010-02-02 5:56 ` H.J. Lu [this message]
2010-02-02 11:04 ` Nick Clifton
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=6dc9ffc81002012155j6f2ee40od330de7d0073c5ce@mail.gmail.com \
--to=hjl.tools@gmail.com \
--cc=binutils@sourceware.org \
--cc=gdb-patches@sourceware.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