From nobody Fri Jun 17 19:36:49 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CA38F85A2E8; Fri, 17 Jun 2022 19:36:49 +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 4LPq6n3cTVz3PHw; Fri, 17 Jun 2022 19:36:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494609; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FXuIxPutCYwBb7dEVksX39ZcuUFP4eHcSRNkslO2+s0=; b=RbS8VOOYLkB1t/Wz4DrWaSu1OI2m5zNoOz5W16CwBPs0rygpoHE/iAuoZEZSKhxVG4SUFl SfBYoNdiqkQkmg5CRc8C3f6ak0z6KWXIXK6ZI60EAQpFJqJ7ZVeievEO/uxAlLqBe+SY4q WXn7XVF4L+aYgqBSkjyKGFBF2XNl7gq4xiEWoBnyuQHcdAQYf6eqGMQJfBZL02m3RvmDXd v/H9uvam67OiQNhSyPrCl/XNyf+7Vjw8ghzBN+V9GRxr9t2hQhp/L8k9V59K3j5Dm3pS+E 3CUdVGoIs50EbMAEqE1W9TX67nHSkT95JBKtuXoY9xtRKpfgzRYhfq1VSQ5XIw== 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 37EE8257CD; Fri, 17 Jun 2022 19:36:49 +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 25HJanUW012528; Fri, 17 Jun 2022 19:36:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25HJanAh012527; Fri, 17 Jun 2022 19:36:49 GMT (envelope-from git) Date: Fri, 17 Jun 2022 19:36:49 GMT Message-Id: <202206171936.25HJanAh012527@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: 9240bf3e1ff9 - stable/13 - linux(4): implement coredumps on arm64 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9240bf3e1ff9d1c27891d54763e88bede047aa36 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494609; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FXuIxPutCYwBb7dEVksX39ZcuUFP4eHcSRNkslO2+s0=; b=SiZmK1icvUkp9NlQUayIKrZDd2FQGxOtmiYSAV86civ7UX7PRPfPgcJk/xhG/Cahw2NaEa PMyHoIs23LJBBNJ2fV8y5UUWqXaG/3w5retfSEWM6zFz3OBmsmkVcK+bWppp3Lxl4WV/4E tqerQM9pmJVHInVse3/mYc5rgpZi3Gjeh4k8ak8CqE9jUpfx8tvmpPT3TEclE7vc/yuq+X zsBWYNFdgz2izcnuVAt94ISLTqONyVj1XJ3+r+/xneTK8j3be9BcUIvZAr3LYziXbX0m1P YlPWAhv0g7F3Z1vzvsqbv9LErLFRCqgstwB1EuR9VwzOpuqRcI/3cMs9mUI0fA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655494609; a=rsa-sha256; cv=none; b=EMpKdo4oia2r9jEA+sl6G2lIrqnMzqGaH0WrubcQwMVH/pLkOyrQmYkvT/sQmC52DxhtTU wnCmErFdfYehJRu0+FF0aorT+Ecjavv1g6Y4ExS93HTqgvLOkqz74aI561R5JIaJeV2UgC R/RpqqEgicfFCxlWCm6GPV5oJJOE6LKGL2TVx8a+uqVQqOOBmtQmx3I2Y8O0YlPs252ThS NkaFLWdFDwJVoiw+cow8/nS82QY/403I+LiVlr1qKficHBo4xP/lGar9WeP7q+p+8Fj+sz nY1BLxERWoYYyCF89JjgVeSwqCeVbggarKD3ZBlj9MO8oC6XZq7R6nSWZZqYfQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=9240bf3e1ff9d1c27891d54763e88bede047aa36 commit 9240bf3e1ff9d1c27891d54763e88bede047aa36 Author: Edward Tomasz Napierala AuthorDate: 2021-07-03 07:05:44 +0000 Commit: Dmitry Chagin 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 +#include + #include #include #include @@ -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