Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Oct 2019 14:15:50 +0000 (UTC)
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r353436 - in head: sys/arm64/include usr.bin/gcore
Message-ID:  <201910111415.x9BEFoMV097201@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhibbits
Date: Fri Oct 11 14:15:50 2019
New Revision: 353436
URL: https://svnweb.freebsd.org/changeset/base/353436

Log:
  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

Modified:
  head/sys/arm64/include/elf.h
  head/usr.bin/gcore/Makefile
  head/usr.bin/gcore/elf32core.c

Modified: head/sys/arm64/include/elf.h
==============================================================================
--- head/sys/arm64/include/elf.h	Fri Oct 11 13:34:09 2019	(r353435)
+++ head/sys/arm64/include/elf.h	Fri Oct 11 14:15:50 2019	(r353436)
@@ -64,7 +64,11 @@ typedef struct {	/* Auxiliary vector entry on initial 
 
 __ElfType(Auxinfo);
 
+#ifdef _MACHINE_ELF_WANT_32BIT
+#define	ELF_ARCH	EM_ARM
+#else
 #define	ELF_ARCH	EM_AARCH64
+#endif
 
 #define	ELF_MACHINE_OK(x) ((x) == (ELF_ARCH))
 

Modified: head/usr.bin/gcore/Makefile
==============================================================================
--- head/usr.bin/gcore/Makefile	Fri Oct 11 13:34:09 2019	(r353435)
+++ head/usr.bin/gcore/Makefile	Fri Oct 11 14:15:50 2019	(r353436)
@@ -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
 

Modified: head/usr.bin/gcore/elf32core.c
==============================================================================
--- head/usr.bin/gcore/elf32core.c	Fri Oct 11 13:34:09 2019	(r353435)
+++ head/usr.bin/gcore/elf32core.c	Fri Oct 11 14:15:50 2019	(r353436)
@@ -32,7 +32,15 @@ elf_convert_gregset(elfcore_gregset_t *rd, struct reg 
 	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 fp
 #ifdef __amd64__
 	/* XXX this is wrong... */
 	memcpy(rd, rs, sizeof(*rd));
+#elif defined(__aarch64__)
+	/* ARM64TODO */
 #else
 #error Unsupported architecture
 #endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910111415.x9BEFoMV097201>