svn commit: r353437 - head/usr.bin/gcore

Justin Hibbits jhibbits at FreeBSD.org
Fri Oct 11 14:17:32 UTC 2019


Author: jhibbits
Date: Fri Oct 11 14:17:31 2019
New Revision: 353437
URL: https://svnweb.freebsd.org/changeset/base/353437

Log:
  gcore: Add powerpc64 32-bit gcore support
  
  Summary: Add the necessary bits for taking 32-bit gcore coredumps on powerpc64.
  
  Reviewed by:	luporl
  Differential Revision:	https://reviews.freebsd.org/D21954

Modified:
  head/usr.bin/gcore/Makefile
  head/usr.bin/gcore/elf32core.c

Modified: head/usr.bin/gcore/Makefile
==============================================================================
--- head/usr.bin/gcore/Makefile	Fri Oct 11 14:15:50 2019	(r353436)
+++ head/usr.bin/gcore/Makefile	Fri Oct 11 14:17:31 2019	(r353437)
@@ -5,7 +5,8 @@ PROG=	gcore
 SRCS=	elfcore.c gcore.c
 LIBADD=	sbuf util
 
-.if ${MACHINE_ARCH} == "aarch64" || ${MACHINE_ARCH} == "amd64"
+.if ${MACHINE_ARCH} == "aarch64" || ${MACHINE_ARCH} == "amd64" || \
+    ${MACHINE_ARCH} == "powerpc64"
 SRCS+=	elf32core.c
 .endif
 

Modified: head/usr.bin/gcore/elf32core.c
==============================================================================
--- head/usr.bin/gcore/elf32core.c	Fri Oct 11 14:15:50 2019	(r353436)
+++ head/usr.bin/gcore/elf32core.c	Fri Oct 11 14:17:31 2019	(r353437)
@@ -41,6 +41,17 @@ elf_convert_gregset(elfcore_gregset_t *rd, struct reg 
 	rd->r_lr = rs->x[14];
 	rd->r_pc = rs->elr;
 	rd->r_cpsr = rs->spsr;
+#elif defined(__powerpc64__)
+	int i;
+
+	for (i = 0; i < 32; i++)
+		rd->fixreg[i] = rs->fixreg[i];
+	rd->lr = rs->lr;
+	rd->cr = rs->cr;
+	rd->xer = rs->xer;
+	rd->ctr = rs->ctr;
+	rd->pc = rs->pc;
+#else
 #error Unsupported architecture
 #endif
 }
@@ -53,6 +64,8 @@ elf_convert_fpregset(elfcore_fpregset_t *rd, struct fp
 	memcpy(rd, rs, sizeof(*rd));
 #elif defined(__aarch64__)
 	/* ARM64TODO */
+#elif defined(__powerpc64__)
+	memcpy(rd, rs, sizeof(*rd));
 #else
 #error Unsupported architecture
 #endif


More information about the svn-src-all mailing list