From nobody Sun Sep 28 16:30:37 2025 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1756383751; cv=none; d=zohomail.com; s=zohoarc; b=EWEtbuMmObvZ6qzWCHEglqLryznowo54t/vDaejlBqizhhz8jtkgCb8Aqr96vfv/8us53Ne21Fz+JQD50Wg9bb8Eybq9zdfU+T4OW91kSRZTbckBRYrSPDLWusFxQZdTRt7HrACuoHgZ1dpL9fEsY/2D3BW6XYjqJmLhJ40/6Fw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756383751; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=kq3UR6cJAVbU6RZVHbic254O03tLZOp/eHhdQes8t1Y=; b=ULFhQYTg1MofyoJStMF5jG6Ov9p/1m5uXaak2bPlQbNFQmxIm/PIbU/WAJwDbgx3zmI8wNNUIeepdgFVKRCBziML9eHi0H/lsJliiQMOhGS0cGi/z3BMtJH8nqvO8L2RB6dKqZ6RZyX1WyAvq1K4YnsA8yHNU0xM8f2KO79bfcY= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756383751604773.3364593200849; Thu, 28 Aug 2025 05:22:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1urbTx-0005ua-MR; Thu, 28 Aug 2025 08:11:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1urbRp-00030y-Fx for qemu-devel@nongnu.org; Thu, 28 Aug 2025 08:09:49 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1urbRl-0007IE-VP for qemu-devel@nongnu.org; Thu, 28 Aug 2025 08:09:45 -0400 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-b471737b347so589302a12.1 for ; Thu, 28 Aug 2025 05:09:40 -0700 (PDT) Received: from stoup.. ([144.6.121.55]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b49cb8b4b98sm13933222a12.19.2025.08.28.05.09.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Aug 2025 05:09:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1756382979; x=1756987779; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kq3UR6cJAVbU6RZVHbic254O03tLZOp/eHhdQes8t1Y=; b=SZ4hYkIdrtJcSLVsWVKPZLCOq6yz39ZO14OongqWPxNh9n5tLzd9I9iBwFmJ/XgDt1 JaqmsfKUrFwy/8E1SysFUqf3J3x247/M/fd8f3hvHJkQsohjzAyZM4x1tjWFt/SOEmQh jJUpvbAd3bBzbnk2EnkukmT8K7+4I4RR2HImdhsrR/W/CHyFAUiJHrZWTO44DG1fDA4+ 3c00PPqL9BMpBOLxHkww73MGrH5yJhwC2n//e7on4ZjVrcD7y23KTjLAWdIlh1eWfO1u 1he/iCtqiCyf3at+tybMDrnVGFET0m/a1yErUlPZlOlHNFfmDW3hoowZwAZUDweQJXdb SU9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756382979; x=1756987779; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kq3UR6cJAVbU6RZVHbic254O03tLZOp/eHhdQes8t1Y=; b=S4r0HUKybLKVUbI39q39LdNcNu7Nbrk9a/TkP/AbG/aVV/GYLhn0DEsX4k3UMjX2pc 8Ic97LpAavrIZpvlhtQiEwUzzX7RvQhVpr7nRtXQrCHkO9ZEJnxf2Zy+86BmKMQSPAfd C5+7xYOu0zqcFvh4LBzKWcGYsxeRNuzpYguUMw6wKJia5R78rIHTVHsiCKwS1hMiVtga o6jMRAwIiS6tK/Q0e4E3X93omjkU8M6Uy5+VoxEKgipzMZ3xvIAuI1My02jYehYqjG6n RMcrl5zLLOyh1NR8+Qx1a3RuHcMwtum+XmLo7lVuqrGrOTlCT0MWp+1dCgEb7MGDbscW 1kjA== X-Gm-Message-State: AOJu0Yy9aLtJj41NN+tJEMfps7JjxOKL5G2yokWkzZxhmRYvsVPw1oZD kl9pdyxX5iEVWlJ1ZJcT/niFBZHL1Kxu6SAKldcklhBhBNKZ+t9pOO06zQtashdtGyB5/U0oF5z 8xhYJpLk= X-Gm-Gg: ASbGncs/HGEUxqIbNm+QhGiXqxRTibfZMVfnQDyipaXUXASsw+/PzgitRggIoJWlwQD nSghSwVxQJhaHYcaMEoEa9crWryX7rVOReSwpXHTj5ounXhH+x6WdYgczwD5hca++XVCOoMhPd4 4JrefrNl75Eb3pzD2VTxApug5YNcRoKT+snSqAHJPQdTQDKLRHBUW7hF4SVw0CUHGJBRnUCRdbI B1eFDrinehHf4uunP9SIdQb+ybOICWC7NK4M+FTcQBkWq9w6bcpUAaMLBd4ImIVopzj7/GggoUx obq8cOjKyRjujfeZlw1qNV9t5jpunT7Qf5XE3NN+SXoxlcq/qVcRAb8gI3cYKNwVN8u8fMkNAtj 7kVCf2EhcdgGcjsncULVegUS9QYnI7aiX6DQM X-Google-Smtp-Source: AGHT+IFzO9SIhPTdp6WnGfhtPYGHYN07gCPGLJg8ZtVFjkyp9d1JIz4Wvk9A6e/VYiOKtZa6lkvyvg== X-Received: by 2002:a17:90b:3503:b0:31f:867:d6b4 with SMTP id 98e67ed59e1d1-32515edd015mr28327411a91.10.1756382979391; Thu, 28 Aug 2025 05:09:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH v3 24/87] linux-user: Move elf_core_copy_regs to openrisc/elfload.c Date: Thu, 28 Aug 2025 22:07:33 +1000 Message-ID: <20250828120836.195358-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250828120836.195358-1-richard.henderson@linaro.org> References: <20250828120836.195358-1-richard.henderson@linaro.org> 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=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x532.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 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 @linaro.org) X-ZM-MESSAGEID: 1756383752211116600 Content-Type: text/plain; charset="utf-8" Move elf_core_copy_regs to elfload.c. Move HAVE_ELF_CORE_DUMP, ELF_NREGS, target_elf_gregset_t to target_elf.h. For now, duplicate the definitions of target_elf_greg_t and tswapreg. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- linux-user/openrisc/target_elf.h | 10 ++++++++++ linux-user/elfload.c | 16 ---------------- linux-user/openrisc/elfload.c | 12 ++++++++++++ 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/linux-user/openrisc/target_elf.h b/linux-user/openrisc/target_= elf.h index b34f2ff672..e97bdc11ed 100644 --- a/linux-user/openrisc/target_elf.h +++ b/linux-user/openrisc/target_elf.h @@ -8,4 +8,14 @@ #ifndef OPENRISC_TARGET_ELF_H #define OPENRISC_TARGET_ELF_H =20 +#define HAVE_ELF_CORE_DUMP 1 + +typedef abi_ulong target_elf_greg_t; + +/* See linux kernel arch/openrisc/include/asm/elf.h. */ +#define ELF_NREG 34 /* gprs and pc, sr */ +typedef struct target_elf_gregset_t { + target_elf_greg_t regs[ELF_NREG]; +} target_elf_gregset_t; + #endif diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 96ed6b6515..8c3ef41312 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -424,24 +424,8 @@ static const VdsoImageInfo *vdso_image_info(uint32_t e= lf_flags) #define ELF_CLASS ELFCLASS32 #define ELF_DATA ELFDATA2MSB =20 -#define HAVE_ELF_CORE_DUMP #define ELF_EXEC_PAGESIZE 8192 =20 -/* See linux kernel arch/openrisc/include/asm/elf.h. */ -#define ELF_NREG 34 /* gprs and pc, sr */ -typedef struct target_elf_gregset_t { - target_elf_greg_t regs[ELF_NREG]; -} target_elf_gregset_t; - -void elf_core_copy_regs(target_elf_gregset_t *r, const CPUOpenRISCState *e= nv) -{ - for (int i =3D 0; i < 32; i++) { - r->regs[i] =3D tswapreg(cpu_get_gpr(env, i)); - } - r->regs[32] =3D tswapreg(env->pc); - r->regs[33] =3D tswapreg(cpu_get_sr(env)); -} - #endif /* TARGET_OPENRISC */ =20 #ifdef TARGET_SH4 diff --git a/linux-user/openrisc/elfload.c b/linux-user/openrisc/elfload.c index b92442dfeb..bb5ad96711 100644 --- a/linux-user/openrisc/elfload.c +++ b/linux-user/openrisc/elfload.c @@ -3,9 +3,21 @@ #include "qemu/osdep.h" #include "qemu.h" #include "loader.h" +#include "target_elf.h" =20 =20 const char *get_elf_cpu_model(uint32_t eflags) { return "any"; } + +#define tswapreg(ptr) tswapal(ptr) + +void elf_core_copy_regs(target_elf_gregset_t *r, const CPUOpenRISCState *e= nv) +{ + for (int i =3D 0; i < 32; i++) { + r->regs[i] =3D tswapreg(cpu_get_gpr(env, i)); + } + r->regs[32] =3D tswapreg(env->pc); + r->regs[33] =3D tswapreg(cpu_get_sr(env)); +} --=20 2.43.0