summaryrefslogtreecommitdiff
path: root/usr.bin/gcore
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/gcore')
-rw-r--r--usr.bin/gcore/Makefile3
-rw-r--r--usr.bin/gcore/elf32core.c13
2 files changed, 15 insertions, 1 deletions
diff --git a/usr.bin/gcore/Makefile b/usr.bin/gcore/Makefile
index 205b3f1ea46c..e58f4ede82b3 100644
--- a/usr.bin/gcore/Makefile
+++ b/usr.bin/gcore/Makefile
@@ -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
diff --git a/usr.bin/gcore/elf32core.c b/usr.bin/gcore/elf32core.c
index ba35631f4fb3..4e91fb0bc065 100644
--- a/usr.bin/gcore/elf32core.c
+++ b/usr.bin/gcore/elf32core.c
@@ -41,6 +41,17 @@ elf_convert_gregset(elfcore_gregset_t *rd, struct reg *rs)
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 fpreg *rs)
memcpy(rd, rs, sizeof(*rd));
#elif defined(__aarch64__)
/* ARM64TODO */
+#elif defined(__powerpc64__)
+ memcpy(rd, rs, sizeof(*rd));
#else
#error Unsupported architecture
#endif