This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] [PPC] VSX registers support on core files


On Thu, 2008-07-10 at 15:34 -0300, Luis Machado wrote:
> Hi folks,
> 
> This patch adds VSX registers support for core files by adding one
> more
> note section.

This updated patch adds VSX support to readelf as well.

Luis



2008-07-10  Luis Machado  <luisgpm@br.ibm.com>

	* bfd/elf-bfd.h: Declare elfcore_write_ppc_vsx.
	* bfd/elf.c (elfcore_grok_ppc_vsx): New function.
	(elfcore_write_ppc_vsx): New function
	(elfcore_grok_note): Handle VSX notes.
	(elfcore_write_register_note): Handle VSX notes.
	* include/elf/common.h: Define NT_PPC_VSX.
	* binutils/readelf.c (get_note_type): Handle VSX notes.

Index: bfd/elf-bfd.h
===================================================================
--- bfd/elf-bfd.h.orig	2008-05-24 09:14:59.000000000 -0700
+++ bfd/elf-bfd.h	2008-07-10 13:49:06.000000000 -0700
@@ -2141,6 +2141,8 @@
   (bfd *, char *, int *, const void *, int);
 extern char *elfcore_write_ppc_vmx
   (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_ppc_vsx
+  (bfd *, char *, int *, const void *, int);
 extern char *elfcore_write_lwpstatus
   (bfd *, char *, int *, long, int, const void *);
 extern char *elfcore_write_register_note
Index: bfd/elf.c
===================================================================
--- bfd/elf.c.orig	2008-07-09 18:32:22.000000000 -0700
+++ bfd/elf.c	2008-07-10 13:49:06.000000000 -0700
@@ -7553,6 +7553,11 @@
   return elfcore_make_note_pseudosection (abfd, ".reg-ppc-vmx", note);
 }
 
+static bfd_boolean
+elfcore_grok_ppc_vsx (bfd *abfd, Elf_Internal_Note *note)
+{
+  return elfcore_make_note_pseudosection (abfd, ".reg-ppc-vsx", note);
+}
 
 #if defined (HAVE_PRPSINFO_T)
 typedef prpsinfo_t   elfcore_psinfo_t;
@@ -7908,6 +7913,13 @@
       else
 	return TRUE;
 
+    case NT_PPC_VSX:
+      if (note->namesz == 6
+          && strcmp (note->namedata, "LINUX") == 0)
+        return elfcore_grok_ppc_vsx (abfd, note);
+      else
+        return TRUE;
+
     case NT_PRPSINFO:
     case NT_PSINFO:
       if (bed->elf_backend_grok_psinfo)
@@ -8475,6 +8487,18 @@
 }
 
 char *
+elfcore_write_ppc_vsx (bfd *abfd,
+                       char *buf,
+                       int *bufsiz,
+                       const void *ppc_vsx,
+                       int size)
+{
+  char *note_name = "LINUX";
+  return elfcore_write_note (abfd, buf, bufsiz,
+                             note_name, NT_PPC_VSX, ppc_vsx, size);
+}
+
+char *
 elfcore_write_register_note (bfd *abfd,
 			     char *buf,
 			     int *bufsiz,
@@ -8488,6 +8512,8 @@
     return elfcore_write_prxfpreg (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)
+    return elfcore_write_ppc_vsx (abfd, buf, bufsiz, data, size);
   return NULL;
 }
 
Index: include/elf/common.h
===================================================================
--- include/elf/common.h.orig	2008-06-18 04:03:03.000000000 -0700
+++ include/elf/common.h	2008-07-10 13:49:06.000000000 -0700
@@ -443,6 +443,8 @@
 					/*   note name must be "LINUX".  */
 #define NT_PPC_VMX	0x100		/* PowerPC Altivec/VMX registers */
 					/*   note name must be "LINUX".  */
+#define NT_PPC_VSX	0x102		/* PowerPC VSX registers */
+					/*   note name must be "LINUX".  */
 
 /* Note segments for core files on dir-style procfs systems.  */
 
Index: binutils/readelf.c
===================================================================
--- binutils/readelf.c.orig	2008-07-09 18:32:23.000000000 -0700
+++ binutils/readelf.c	2008-07-10 13:52:14.000000000 -0700
@@ -9934,6 +9934,8 @@
 	return _("NT_PRXFPREG (user_xfpregs structure)");
       case NT_PPC_VMX:
 	return _("NT_PPC_VMX (ppc Altivec registers)");
+      case NT_PPC_VSX:
+	return _("NT_PPC_VSX (ppc VSX registers)");
       case NT_PSTATUS:
 	return _("NT_PSTATUS (pstatus structure)");
       case NT_FPREGS:



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]