From owner-dev-commits-src-all@freebsd.org Sat Jul 3 07:41:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B20264D29D; Sat, 3 Jul 2021 07:41:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GH3mH03dkz3vhq; Sat, 3 Jul 2021 07:41:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DEC8E23B71; Sat, 3 Jul 2021 07:41:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1637fIft077632; Sat, 3 Jul 2021 07:41:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1637fI1e077631; Sat, 3 Jul 2021 07:41:18 GMT (envelope-from git) Date: Sat, 3 Jul 2021 07:41:18 GMT Message-Id: <202107030741.1637fI1e077631@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 45d99014ca3a - main - linux(4): implement coredumps on arm64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 45d99014ca3a57fcc6b603cf4494516b4dadda1b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jul 2021 07:41:19 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=45d99014ca3a57fcc6b603cf4494516b4dadda1b commit 45d99014ca3a57fcc6b603cf4494516b4dadda1b Author: Edward Tomasz Napierala AuthorDate: 2021-07-03 07:05:44 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-07-03 07:06:31 +0000 linux(4): implement coredumps on arm64 Previously they only worked on amd64. Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D30975 --- 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 8e10fc9d26a1..d9b13fa631fc 100644 --- a/sys/arm64/linux/linux_machdep.c +++ b/sys/arm64/linux/linux_machdep.c @@ -40,6 +40,8 @@ __FBSDID("$FreeBSD$"); #include +#include + #include #include #include @@ -149,3 +151,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 33bc303b5ada..e1d3708b70e9 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -417,8 +417,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 d70983354407..5f3f0fd03574 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