aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/gcore
diff options
context:
space:
mode:
authorJustin Hibbits <jhibbits@FreeBSD.org>2019-10-11 14:15:50 +0000
committerJustin Hibbits <jhibbits@FreeBSD.org>2019-10-11 14:15:50 +0000
commit26517dcf60576f345c34909e447a8dd5f5ecf34c (patch)
treeded634ebdca38c0bf35b7b9eeb65e12a61eaf049 /usr.bin/gcore
parent14601230a1d0e2108d6cc60acfa22ce49f1328cd (diff)
downloadsrc-26517dcf60576f345c34909e447a8dd5f5ecf34c.tar.gz
src-26517dcf60576f345c34909e447a8dd5f5ecf34c.zip
gcore: Add aarch64 32-bit core support
Summary: Add trivial 32-bit arm cores on aarch64 support for gcore. This doesn't handle fpregs. Reviewed by: #arm, andrew Sponsored by: Juniper Networks, Inc Differential Revision: https://reviews.freebsd.org/D21947
Notes
Notes: svn path=/head/; revision=353436
Diffstat (limited to 'usr.bin/gcore')
-rw-r--r--usr.bin/gcore/Makefile2
-rw-r--r--usr.bin/gcore/elf32core.c12
2 files changed, 12 insertions, 2 deletions
diff --git a/usr.bin/gcore/Makefile b/usr.bin/gcore/Makefile
index ad4b540f819b..205b3f1ea46c 100644
--- a/usr.bin/gcore/Makefile
+++ b/usr.bin/gcore/Makefile
@@ -5,7 +5,7 @@ PROG= gcore
SRCS= elfcore.c gcore.c
LIBADD= sbuf util
-.if ${MACHINE_ARCH} == "amd64"
+.if ${MACHINE_ARCH} == "aarch64" || ${MACHINE_ARCH} == "amd64"
SRCS+= elf32core.c
.endif
diff --git a/usr.bin/gcore/elf32core.c b/usr.bin/gcore/elf32core.c
index 595b7de95fbb..ba35631f4fb3 100644
--- a/usr.bin/gcore/elf32core.c
+++ b/usr.bin/gcore/elf32core.c
@@ -32,7 +32,15 @@ elf_convert_gregset(elfcore_gregset_t *rd, struct reg *rs)
rd->r_eflags = rs->r_rflags;
rd->r_esp = rs->r_rsp;
rd->r_ss = rs->r_ss;
-#else
+#elif defined(__aarch64__)
+ int i;
+
+ for (i = 0; i < 13; i++)
+ rd->r[i] = rs->x[i];
+ rd->r_sp = rs->x[13];
+ rd->r_lr = rs->x[14];
+ rd->r_pc = rs->elr;
+ rd->r_cpsr = rs->spsr;
#error Unsupported architecture
#endif
}
@@ -43,6 +51,8 @@ elf_convert_fpregset(elfcore_fpregset_t *rd, struct fpreg *rs)
#ifdef __amd64__
/* XXX this is wrong... */
memcpy(rd, rs, sizeof(*rd));
+#elif defined(__aarch64__)
+ /* ARM64TODO */
#else
#error Unsupported architecture
#endif