From nobody Sun Sep 28 16:30:45 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=1756402695; cv=none; d=zohomail.com; s=zohoarc; b=kbWZIJwTyFwNLXriiJAX73+W8d0jVywzs9arSTLD27kgJmoyprRG2LT6d7ZWWoYJNxuWxONAbAIHfgJYGK5vHny4/ncJmkGA/KBbBnBiaIeL16lsk92Y0N6FtLavhDSECEcLyr+8O7SS5vPD3AJExoUI6ZjQz0IkCAFpfxWEl2Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756402695; 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=uExtz+UYbxm5QWgAqrxDGVRQ9u1WmoijCeQeuh+Ni88=; b=h3rVj+9V0paAYo54NFa6S+f0q5L17e53pPExGowF4wo6br23JtLNBO4MIfBOrYv7e3+4LSZ04x/cH8dXKu3H1WTd/OET/otI8RohuNFfGN8NkUZzRCPuqVuSlqM2qm5XA4crLYNyJYDthtn6L4rR656O6Ctp/H9zYQN1eS/6x0w= 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 1756402695313670.0383648601618; Thu, 28 Aug 2025 10:38:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1urgHZ-0005ML-HI; Thu, 28 Aug 2025 13:19:29 -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 1urbSJ-0003rV-Rr for qemu-devel@nongnu.org; Thu, 28 Aug 2025 08:10:21 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1urbSI-0007co-2o for qemu-devel@nongnu.org; Thu, 28 Aug 2025 08:10:15 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-771f69fd6feso1072165b3a.1 for ; Thu, 28 Aug 2025 05:10:13 -0700 (PDT) Received: from stoup.. ([144.6.121.55]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b49cb8b4b98sm13933222a12.19.2025.08.28.05.10.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Aug 2025 05:10:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1756383012; x=1756987812; 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=uExtz+UYbxm5QWgAqrxDGVRQ9u1WmoijCeQeuh+Ni88=; b=pg7/XkvbQ5HzN8jBKHoZiEfeMDfW8U/MyQH99BAs6gBTGwZmJtbYKM0ctBiQaBLJBO Lni5iXBlVsHBukPu5tT2pOVhWgcUVUi7NFtrnDrpYbHtlCNplgqMiucw4pVMKaWkSzzc kGIT+Xot6Se3Fq8XwdeYUH2dL/gK0OtBMAV6kY65pgkE5B0z4vl+Hz7tVvtHfL2sZd9h cgt+RfHCFlHXrP2afJMZgvrhiehA7a2Qn8WiVuO4TuwjagFNextM3IoELyT++7RNw++Y wVfjpLgDA/9h0hTSL76MDhoJOHn0peGHDqmfdtm92tOWrgvvcyXKjKx0SOJrfnNbLWRa xTuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756383012; x=1756987812; 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=uExtz+UYbxm5QWgAqrxDGVRQ9u1WmoijCeQeuh+Ni88=; b=i+VMsEZ6vJ9V/ey3Nl6GkOLEgVYdjFOdx425wCkkpfrFt4H6Ei8XQg2otDvXLEc38+ Fd1IfNLlb0UAMYl8DFaojqiAgHk2MON9DlfgH24caecvnfydiMlxpOsw6s1HtEarQ4PC nMfysRK9XULbYvNLCeoBQEBVKFuYMciMRmhymZgizF+i8TIvtdLE7MrYoZtdNUqmOFEX eIFmOQ4mUf44hH/e6Om1UOClC1Jrf35eQBWqub2HaQ08yrPcNsUrqFxH/4h3P4XCkkAw Fv4KWqpfx3C26O9zDPkSH01wAV1lzDlDfIWdoeZ5RwWVoEyh2IYSs0PPxX4EiRVg8eGd cM6A== X-Gm-Message-State: AOJu0YxKLKREVSll/iCMOeajZl1CYKuBi21YSiIOzGuU9nyfAgueNFgF t6Lx4UEuxQkof/m78LoaVSEiMpBz0585VcQrJ5egU87qeBgCsgG/QslsF5OkuQlOLXNoVvck3i4 sltqDaq0= X-Gm-Gg: ASbGncsCOa1S5Ug3kBNQW7YVzCZe7Lg+orj31IWn+s13xpYqChK4S/1nUqnidDLiy4T NFODQ1WtXrGanfXMNniNYmBw8svAHX6vwEf1IwAGx37L/fj0dHPaEtfAaI4broMgOCQJG14Dbv7 I3cOvx9rLJFYJoPpxNNUsO1Y5rgKilRFar/wJGEvzmehi1tep86SmtNPJJPXJ+nbW9vOrLLQnbT mwNXzslJP0hKajggbp4Q7Ry8UNfVGiBGmx/EP4HtxgM1Og5CFfd+j5gp4woLx+hLCF3q6ObTWWJ PKBUjtwHMCrKIflvBQnoiRr7TAP+M1KB4lhf1zjnP4GzCJr9Ba3XyugWIFrATQaSntlpfQyxav+ jcLQXcKPZWt1Ue3QhlypxHtBtWQ== X-Google-Smtp-Source: AGHT+IFeYPFa84xwrRoko5mXUlNsBdRbncwhQTob5gTkGU2/10BrlJArk+mvL+RAe8A/7UIi+4eXYg== X-Received: by 2002:a17:902:d54e:b0:248:d4d5:8402 with SMTP id d9443c01a7336-248d4d58c41mr35605245ad.20.1756383011994; Thu, 28 Aug 2025 05:10:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH v3 38/87] linux-user/arm: Expand target_elf_gregset_t Date: Thu, 28 Aug 2025 22:07:47 +1000 Message-ID: <20250828120836.195358-39-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::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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: 1756402698724124100 Content-Type: text/plain; charset="utf-8" Make use of the fact that target_elf_gregset_t is a proper structure. Drop ELF_NREG, target_elf_greg_t, and tswapreg. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- linux-user/arm/target_elf.h | 11 +++++++---- linux-user/arm/elfload.c | 8 +++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/linux-user/arm/target_elf.h b/linux-user/arm/target_elf.h index 94db3738e8..fa8f8af2f3 100644 --- a/linux-user/arm/target_elf.h +++ b/linux-user/arm/target_elf.h @@ -8,16 +8,19 @@ #ifndef ARM_TARGET_ELF_H #define ARM_TARGET_ELF_H =20 +#include "target_ptrace.h" + #define HAVE_ELF_HWCAP 1 #define HAVE_ELF_HWCAP2 1 #define HAVE_ELF_PLATFORM 1 #define HAVE_ELF_CORE_DUMP 1 =20 -typedef abi_ulong target_elf_greg_t; - -#define ELF_NREG 18 +/* + * See linux kernel: arch/arm/include/asm/elf.h, where + * elf_gregset_t is mapped to struct pt_regs via sizeof. + */ typedef struct target_elf_gregset_t { - target_elf_greg_t regs[ELF_NREG]; + struct target_pt_regs pt; } target_elf_gregset_t; =20 #endif diff --git a/linux-user/arm/elfload.c b/linux-user/arm/elfload.c index 47fe16a1a6..726d3ec25c 100644 --- a/linux-user/arm/elfload.c +++ b/linux-user/arm/elfload.c @@ -201,13 +201,11 @@ const char *get_elf_platform(CPUState *cs) #undef END } =20 -#define tswapreg(ptr) tswapal(ptr) - void elf_core_copy_regs(target_elf_gregset_t *r, const CPUARMState *env) { for (int i =3D 0; i < 16; ++i) { - r->regs[i] =3D tswapreg(env->regs[i]); + r->pt.regs[i] =3D tswapal(env->regs[i]); } - r->regs[16] =3D tswapreg(cpsr_read((CPUARMState *)env)); - r->regs[17] =3D tswapreg(env->regs[0]); /* XXX */ + r->pt.cpsr =3D tswapal(cpsr_read((CPUARMState *)env)); + r->pt.orig_r0 =3D tswapal(env->regs[0]); } --=20 2.43.0