Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Jun 2022 19:36:49 GMT
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 9240bf3e1ff9 - stable/13 - linux(4): implement coredumps on arm64
Message-ID:  <202206171936.25HJanAh012527@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=9240bf3e1ff9d1c27891d54763e88bede047aa36

commit 9240bf3e1ff9d1c27891d54763e88bede047aa36
Author:     Edward Tomasz Napierala <trasz@FreeBSD.org>
AuthorDate: 2021-07-03 07:05:44 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2022-06-17 19:33:02 +0000

    linux(4): implement coredumps on arm64
    
    Previously they only worked on amd64.
    
    Sponsored By:   EPSRC
    Differential Revision:  https://reviews.freebsd.org/D30975
    
    (cherry picked from commit 45d99014ca3a57fcc6b603cf4494516b4dadda1b)
---
 sys/arm64/linux/linux.h         | 12 ++++++++++++
 sys/arm64/linux/linux_machdep.c | 16 ++++++++++++++++
 sys/arm64/linux/linux_sysvec.c  |  4 ++--
 sys/modules/linux64/Makefile    |  5 ++---
 4 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/sys/arm64/linux/linux.h b/sys/arm64/linux/linux.h
index 5d4739223275..2e683b77f8e8 100644
--- a/sys/arm64/linux/linux.h
+++ b/sys/arm64/linux/linux.h
@@ -298,4 +298,16 @@ struct linux_robust_list_head {
 	l_uintptr_t			pending_list;
 };
 
+struct linux_pt_regset {
+	l_ulong x[31];
+	l_ulong sp;
+	l_ulong pc;
+	l_ulong cpsr;
+};
+
+struct reg;
+
+void	bsd_to_linux_regset(struct reg *b_reg,
+	    struct linux_pt_regset *l_regset);
+
 #endif /* _ARM64_LINUX_H_ */
diff --git a/sys/arm64/linux/linux_machdep.c b/sys/arm64/linux/linux_machdep.c
index 23d9c6423b05..cfb2fd60e44c 100644
--- a/sys/arm64/linux/linux_machdep.c
+++ b/sys/arm64/linux/linux_machdep.c
@@ -41,6 +41,8 @@ __FBSDID("$FreeBSD$");
 
 #include <security/audit/audit.h>
 
+#include <machine/reg.h>
+
 #include <arm64/linux/linux.h>
 #include <arm64/linux/linux_proto.h>
 #include <compat/linux/linux_dtrace.h>
@@ -140,3 +142,17 @@ linux_set_cloned_tls(struct thread *td, void *desc)
 
 	return (cpu_set_user_tls(td, desc));
 }
+
+void
+bsd_to_linux_regset(struct reg *b_reg, struct linux_pt_regset *l_regset)
+{
+
+	KASSERT(sizeof(l_regset->x) == sizeof(b_reg->x) + sizeof(l_ulong),
+	    ("%s: size mismatch\n", __func__));
+	memcpy(l_regset->x, b_reg->x, sizeof(b_reg->x));
+
+	l_regset->x[30] = b_reg->lr;
+	l_regset->sp = b_reg->sp;
+	l_regset->pc = b_reg->elr;
+	l_regset->cpsr = b_reg->spsr;
+}
diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c
index 5a2edcefac2c..1b815b8ac0f2 100644
--- a/sys/arm64/linux/linux_sysvec.c
+++ b/sys/arm64/linux/linux_sysvec.c
@@ -404,8 +404,8 @@ struct sysentvec elf_linux_sysvec = {
 	.sv_name	= "Linux ELF64",
 	.sv_coredump	= elf64_coredump,
 	.sv_elf_core_osabi = ELFOSABI_NONE,
-	.sv_elf_core_abi_vendor = FREEBSD_ABI_VENDOR,
-	.sv_elf_core_prepare_notes = elf64_prepare_notes,
+	.sv_elf_core_abi_vendor = LINUX_ABI_VENDOR,
+	.sv_elf_core_prepare_notes = linux64_prepare_notes,
 	.sv_imgact_try	= linux_exec_imgact_try,
 	.sv_minsigstksz	= LINUX_MINSIGSTKSZ,
 	.sv_minuser	= VM_MIN_ADDRESS,
diff --git a/sys/modules/linux64/Makefile b/sys/modules/linux64/Makefile
index c269a2251b76..0be94033a494 100644
--- a/sys/modules/linux64/Makefile
+++ b/sys/modules/linux64/Makefile
@@ -8,8 +8,8 @@
 VDSO=	linux_vdso
 
 KMOD=	linux64
-SRCS=	linux_fork.c linux_dummy_machdep.c linux_file.c linux_event.c \
-	linux_futex.c linux_getcwd.c linux_ioctl.c linux_ipc.c \
+SRCS=	linux_elf64.c linux_fork.c linux_dummy_machdep.c linux_file.c \
+	linux_event.c linux_futex.c linux_getcwd.c linux_ioctl.c linux_ipc.c \
 	linux_machdep.c linux_misc.c linux_ptrace.c linux_signal.c \
 	linux_socket.c linux_stats.c linux_sysctl.c linux_sysent.c \
 	linux_sysvec.c linux_time.c linux_vdso.c linux_timer.c \
@@ -18,7 +18,6 @@ SRCS=	linux_fork.c linux_dummy_machdep.c linux_file.c linux_event.c \
 	linux_support.s
 .if ${MACHINE_CPUARCH} == "amd64"
 SRCS+=	linux_dummy_x86.c
-SRCS+=	linux_elf64.c
 .endif
 DPSRCS=	assym.inc linux_genassym.c
 



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