From nobody Sun Jun 7 22:17:48 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1780781693; cv=none; d=zohomail.com; s=zohoarc; b=F3jBX5fjJc1ihWwIG4xYUN2/zR08/TJeE6ujhl4Y7kZjHMW/4w+zFUSpvx5NhVcInKfPB8GRZVUMMwqjhu4W2LQ7/lZpQSSATSukN8zE1KI+RevrIHSyDRokvkxDiaxW4zDY8O6LHdnEbo14/zBVRTS7g2PAbM9gbd7NfqTyXQs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780781693; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=et5eLMegT6ampsfftjXOFLTcAsoi2sO/Rg/7dQphinA=; b=FivixYPmzgbqqAlUKRPUmuIkVeNpX4v8Dh/3H5cMigjFONjctv+JZ7+6GMoSjVan2sGaTWtDikKo3dGGZG07tOi+a4z2Igb77QH9GvJbxR3pt0WH61mn+Ns2OLcUMwtL/RAgFEZbTY5C+RriMmbjrxeMvgeVJ6O559zZHF72Ezs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1780781693933844.103649044712; Sat, 6 Jun 2026 14:34:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wVyea-00025M-4C; Sat, 06 Jun 2026 17:34:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wVyeY-00025B-PV for qemu-devel@nongnu.org; Sat, 06 Jun 2026 17:34:02 -0400 Received: from tor.source.kernel.org ([172.105.4.254]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wVyeW-0000wk-BN for qemu-devel@nongnu.org; Sat, 06 Jun 2026 17:34:02 -0400 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id D16BE600AE; Sat, 6 Jun 2026 21:33:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CFE81F00893; Sat, 6 Jun 2026 21:33:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1780781632; bh=et5eLMegT6ampsfftjXOFLTcAsoi2sO/Rg/7dQphinA=; h=From:To:Cc:Subject:Date; b=RmWbr/GM56SwRtzURAxc5LV9/nRuhsjcRhE+bJV2r/EeK4cZgwJV0n0cBl2DZQwDs ogEzkwNnjf1TU1G8lTtnMKl5OW439umS/hof907vdJaTUAjkOv325Bp6IcK2k0uz+A AIRTSdfh/48yaDrsF5yR2QQ5Cl0yO+0t2CEn0RUReVdvio4iqOPbi2Uet35yJ6vsRk WZFJZ8EDLCN31dLKhKdKU/QaU0RUYeOtk4CXTaNKK75C+Q1d0N7u2Nkhanrj3hnANv g1IilTNIOdZVdkSoswXyDgV1joFXTv0Rz5iehXGi5xYtXKqdI1WsfbotBAKYHQKq5r U8hWoOEJVtzeQ== From: Helge Deller To: qemu-devel@nongnu.org Cc: Richard Henderson , Matt Turner , Helge Deller Subject: [PATCH] linux-user/alpha: add coredump support Date: Sat, 6 Jun 2026 23:33:43 +0200 Message-ID: <20260606213343.11970-1-deller@kernel.org> X-Mailer: git-send-email 2.54.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=172.105.4.254; envelope-from=deller@kernel.org; helo=tor.source.kernel.org X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1780781696298158500 Content-Type: text/plain; charset="utf-8" From: Matt Turner Define HAVE_ELF_CORE_DUMP and target_elf_gregset_t in target_elf.h, mirroring the kernel's elf_gregset_t (ELF_NGREG =3D 66): r0-r31 [0..31], f0-f31 [32..63], pc [64], unique [65]. Implement elf_core_copy_regs() in elfload.c to populate the gregset from CPUAlphaState. Without this, bprm->core_dump is NULL for Alpha targets. When a guest signal goes unhandled, dump_core_and_abort() skips the core write and falls through to die_with_signal(), which re-raises the signal to the host. The host kernel then writes an x86-64 core file for the qemu-alpha process instead of an Alpha guest core. v2: Store thread unique field, same as in Linux kernel. Added by Helge & suggested by Richard. Signed-off-by: Matt Turner Signed-off-by: Helge Deller --- linux-user/alpha/elfload.c | 12 ++++++++++++ linux-user/alpha/target_elf.h | 13 +++++++++++++ 2 files changed, 25 insertions(+) diff --git a/linux-user/alpha/elfload.c b/linux-user/alpha/elfload.c index 1e44475c47..d2aed15ce5 100644 --- a/linux-user/alpha/elfload.c +++ b/linux-user/alpha/elfload.c @@ -3,8 +3,20 @@ #include "qemu/osdep.h" #include "qemu.h" #include "loader.h" +#include "target_elf.h" =20 =20 +void elf_core_copy_regs(target_elf_gregset_t *r, const CPUAlphaState *env) +{ + int i; + + for (i =3D 0; i < 31; i++) { + r->regs[i] =3D tswap64(env->ir[i]); + } + r->pc =3D tswap64(env->pc); + r->unique =3D env->unique; +} + const char *get_elf_cpu_model(uint32_t eflags) { return "ev67"; diff --git a/linux-user/alpha/target_elf.h b/linux-user/alpha/target_elf.h index 864dc6e2e6..4987ae3944 100644 --- a/linux-user/alpha/target_elf.h +++ b/linux-user/alpha/target_elf.h @@ -11,4 +11,17 @@ #define ELF_CLASS ELFCLASS64 #define ELF_MACHINE EM_ALPHA =20 +#define HAVE_ELF_CORE_DUMP 1 + +/* + * Matches the kernel's elf_gregset_t (ELF_NGREG =3D 33): + * r0-r30 at indices 0-30, pc at 31, ps at 32. + * r31 (hardwired zero) is not stored; pc occupies index 31. + */ +typedef struct target_elf_gregset_t { + abi_ulong regs[31]; /* integer registers r0-r30 [0..30] */ + abi_ulong pc; /* program counter [31] */ + abi_ulong unique; /* thread's UNIQUE field [32] */ +} target_elf_gregset_t; + #endif --=20 2.54.0