Add NT_386_XSTATE.
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 2 Feb 2010 12:37:40 +0000 (12:37 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 2 Feb 2010 12:37:40 +0000 (12:37 +0000)
bfd/

2010-02-02  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-02-02  H.J. Lu  <hongjiu.lu@intel.com>

* readelf.c (get_note_type): Handle NT_X86_XSTATE.

include/elf/

2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>

* common.h (NT_386_XSTATE): New.

bfd/ChangeLog
bfd/elf-bfd.h
bfd/elf.c
binutils/ChangeLog
binutils/readelf.c
include/elf/ChangeLog
include/elf/common.h

index 7e1f1c29a67b3b4869858479711e7db9f805e60a..791ec74424e44ba4154ed252ec4fa46d0efc4474 100644 (file)
@@ -1,3 +1,12 @@
+2010-02-02  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.
+
 2010-02-01  Tristan Gingold  <gingold@adacore.com>
 
        * som.c (som_write_ar_hdr): Define this macro.
index daa2b62d9a5966e9aa157d657b7333f391ec7f5e..3c3ac9b256bd59b6b97e7b0ad76b8596aa2e0b93 100644 (file)
@@ -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
index 19e4695f2b644313d59d17536a33ba88c999821f..c1762564ac11e9afc0c2f4c469c83e895259443a 100644 (file)
--- 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)
 {
@@ -7996,6 +8006,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)
@@ -8635,6 +8652,15 @@ elfcore_write_prxfpreg (bfd *abfd,
                             note_name, NT_PRXFPREG, xfpregs, size);
 }
 
+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,
@@ -8684,6 +8710,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)
index 719192b5ff2f271ff2f3657b12e1d2ddc4fa4aa7..ede4c6de667523e72c1f4a740fea6bcfcd4bba3a 100644 (file)
@@ -1,3 +1,7 @@
+2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * readelf.c (get_note_type): Handle NT_X86_XSTATE.
+
 2010-02-01  Nathan Sidwell  <nathan@codesourcery.com>
 
        * objcopy.c (copy_object): Set SEC_LINKER_CREATED when adding
index b9de73a116a73198f543e6cdd8061d14a2f01a96..34dbfacf516db08aabea84b25740fe144d567d95 100644 (file)
@@ -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:
index ee204ccb101f6bdf6ccb49d839d2743e6149e0a3..41f1286c29aaeb72cbd209c493bdaee0b896cfa7 100644 (file)
@@ -1,6 +1,10 @@
+2010-02-02  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * common.h (NT_386_XSTATE): New.
+
 2010-01-19  Daisuke Hatayama  <d.hatayama@jp.fujitsu.com>
 
-        * common.h (PN_XNUM): Define.
+       * common.h (PN_XNUM): Define.
 
 2009-12-18  Ulrich Weigand  <uweigand@de.ibm.com>
 
index 703916e64908a1d9a2a9203ec437ae601e0313d8..a7629023193b850f4e116273fb435004dc4d5b6b 100644 (file)
                                        /*   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".  */