From nobody Sun Sep 28 16:30:44 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=1756404583; cv=none; d=zohomail.com; s=zohoarc; b=KrOwLgu1q8tUpMkYO+U6Tst9YIO1luk+FGILaHr/zClL0oWst3zDeHCsszLtmI/T0At6UqOQkG9EeC2tmlg4Od3dJoP435UyyQ8IvTFkEiJYZrbm1Dm8+4zc9C5kNJXJsSfiV1oO2mUrQwCvX8o7SEvvLsY2VnMmJyX6D8vLsKU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756404583; 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=b9WlSjF0+HjwhfJFeJ6DVK0cBfr4XpFmhJQo+afKF+s=; b=ZBVt3ycb/76NjpLBRZfPKLNMMRxqhnFVIPm/ZlfpbAMW3iFtVRgLek84G4FbFzvWfVvgt/oJKuFN/fIdZ0IqhCq5AZO5v2Tujx5i1wIXYoZvIhC2qSzPakcORBAvaJKvPymSCd9Wmdgq6cqVzhWwlOaen10+sh5K4koowfWfrXE= 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 175640458299260.47608320697259; Thu, 28 Aug 2025 11:09:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1urgBm-0002ZN-LF; Thu, 28 Aug 2025 13:13:30 -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 1urbVU-0007VC-Tk for qemu-devel@nongnu.org; Thu, 28 Aug 2025 08:13:39 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1urbVS-0008BC-VI for qemu-devel@nongnu.org; Thu, 28 Aug 2025 08:13:32 -0400 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-b471756592cso598085a12.3 for ; Thu, 28 Aug 2025 05:13:30 -0700 (PDT) Received: from stoup.. ([144.6.121.55]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-248e3e0b75esm15129025ad.8.2025.08.28.05.13.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Aug 2025 05:13:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1756383209; x=1756988009; 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=b9WlSjF0+HjwhfJFeJ6DVK0cBfr4XpFmhJQo+afKF+s=; b=Fc5wCtUD09BZ7j46w6arblK+OdzvLEClCYOktwmroLPOZ7/LlyjLlMEPH4+sy2KDbG rF1bsSJiyjNnO1d53xNFgxtbX/LDgEF98dsKY7kyEHhkwD+DszvNvfVVLavjnhKaYE5/ yI8ZM3GiAFDrjGONU2DkjsoSwUc1ljfIMcXyUffUVKlrNUYYbpR4rzwB8kvP8OHBVT0Y FZ5Iyd9VegTTtbDoztgIWmBg/IgrMTWETl7leRmljblteNBFtbFDoOd3JYH2iLaHNQX2 jwArOzXXyBN97nOMruN9JZ/O/l7gAXJ/hWxga8rtHys4JqDs07hqZw/5htaFrN2yv+e8 +frA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756383209; x=1756988009; 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=b9WlSjF0+HjwhfJFeJ6DVK0cBfr4XpFmhJQo+afKF+s=; b=ZjR4XnsF9jK8qU9PMlP3oYBlZpV6BtCUN8I3lilXD3GfQuEcuEIW6SagUJ+/+S6/An 9VE/De2/rk8zS0BcebBKc69t7lTGhosrKiQEk2ObJ4Mc8JUZfSHJLr6eVTUAE7iwziYk Q+qrwZ2QG2FkV1wUKOFmM4MQouUkZyZeoAK1OR2oLeqFMk+t7NvYp1szhfs0qQOJmQj6 biQFa7GVlVA/4iMe3CKlnTC3NWAyTmimBE+GFKMcPuWwjqCPviws3kxjFqVNnlUwA0BW JfX5IZBUQkZW3ppGykd1TSM+Sx62lb2piKDZ6DRsWsHrlyKjTufGtor5XVP3phTKwwCf 5SPQ== X-Gm-Message-State: AOJu0Yw5VzdDizSd1/ciFf3gA2SKDA3FWG4bAjlBEVtl5Z0LjRXeke4n zmVJBx4H2W901m42YMgBILT8xprKQ0MGKOTOn+GN4/gEyjUj1cdlOTJqXAAFWkby8+OJjMOeIne vRYF6MWA= X-Gm-Gg: ASbGncusEBuB7ww8qZtWQkHzBNUX37gTwkoF/M0DQV9/XdKTNiY6Urn7I448C0Cu+Zi UwQi9ASIAM/TvpzBbz2DVbG1LBu1DYVmAHkWGzx2c73hU5EX5skdOQBTWvvUslzVgYSzosz6NvQ kgEVOWD+vi7JxOYB1K48ABj9SgruSI1zmUqHJytvvo5SQV92HuHHEeB355R3f0XCnR/7F/KxY1Y IMgbNqYRtGodiMg+SfRPzfdwFdHDaI59enIjc+i0g/ASe8Y2YkCEQqfbYZa86j1EQAuHMX16pMm 9znLnZG7FYdwC0XOfBN7GAGO+hOkfDY1Mr3faoWRi5iixT7fiih77IbOibv8jmDWKlKB3YZvXsC zlfbXvZEgRPTaeh/NS1TOJBus3XiyfkjbBYEn X-Google-Smtp-Source: AGHT+IEYP/ILgr4L4QmKcULUOk2t7mhr0of12kX8Kaxru8fohKz5l1ABc5LA1Y3uqk+lWqR4ngmjiA== X-Received: by 2002:a17:902:f542:b0:248:7b7e:11e8 with SMTP id d9443c01a7336-2487b7e1af0mr121236745ad.18.1756383209000; Thu, 28 Aug 2025 05:13:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PATCH v3 41/87] linux-user/m68k: Expand target_elf_gregset_t Date: Thu, 28 Aug 2025 22:07:50 +1000 Message-ID: <20250828120836.195358-42-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::52d; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52d.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: 1756404585754124100 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/m68k/target_elf.h | 24 ++++++++++++++++----- linux-user/m68k/elfload.c | 42 +++++++++++++++++------------------- 2 files changed, 39 insertions(+), 27 deletions(-) diff --git a/linux-user/m68k/target_elf.h b/linux-user/m68k/target_elf.h index cd6908ab57..0737412cee 100644 --- a/linux-user/m68k/target_elf.h +++ b/linux-user/m68k/target_elf.h @@ -10,12 +10,26 @@ =20 #define HAVE_ELF_CORE_DUMP 1 =20 -typedef abi_ulong target_elf_greg_t; - -/* See linux kernel: arch/m68k/include/asm/elf.h. */ -#define ELF_NREG 20 +/* + * See linux kernel: arch/m68k/include/asm/elf.h, where + * elf_gregset_t is mapped to struct user_regs_struct via sizeof. + * + * Note that user_regs_struct has + * short stkadj, sr; + * ... + * short fmtvec, __fill; + * but ELF_CORE_COPY_REGS writes to unsigned longs. + * Therefore adjust the sr and fmtvec fields to match. + */ typedef struct target_elf_gregset_t { - target_elf_greg_t regs[ELF_NREG]; + abi_ulong d1, d2, d3, d4, d5, d6, d7; + abi_ulong a0, a1, a2, a3, a4, a5, a6; + abi_ulong d0; + abi_ulong usp; + abi_ulong orig_d0; + abi_ulong sr; + abi_ulong pc; + abi_ulong fmtvec; } target_elf_gregset_t; =20 #endif diff --git a/linux-user/m68k/elfload.c b/linux-user/m68k/elfload.c index 2970ff7dec..423d1f680a 100644 --- a/linux-user/m68k/elfload.c +++ b/linux-user/m68k/elfload.c @@ -18,28 +18,26 @@ const char *get_elf_cpu_model(uint32_t eflags) return "any"; } =20 -#define tswapreg(ptr) tswapal(ptr) - void elf_core_copy_regs(target_elf_gregset_t *r, const CPUM68KState *env) { - r->regs[0] =3D tswapreg(env->dregs[1]); - r->regs[1] =3D tswapreg(env->dregs[2]); - r->regs[2] =3D tswapreg(env->dregs[3]); - r->regs[3] =3D tswapreg(env->dregs[4]); - r->regs[4] =3D tswapreg(env->dregs[5]); - r->regs[5] =3D tswapreg(env->dregs[6]); - r->regs[6] =3D tswapreg(env->dregs[7]); - r->regs[7] =3D tswapreg(env->aregs[0]); - r->regs[8] =3D tswapreg(env->aregs[1]); - r->regs[9] =3D tswapreg(env->aregs[2]); - r->regs[10] =3D tswapreg(env->aregs[3]); - r->regs[11] =3D tswapreg(env->aregs[4]); - r->regs[12] =3D tswapreg(env->aregs[5]); - r->regs[13] =3D tswapreg(env->aregs[6]); - r->regs[14] =3D tswapreg(env->dregs[0]); - r->regs[15] =3D tswapreg(env->aregs[7]); - r->regs[16] =3D tswapreg(env->dregs[0]); /* FIXME: orig_d0 */ - r->regs[17] =3D tswapreg(env->sr); - r->regs[18] =3D tswapreg(env->pc); - r->regs[19] =3D 0; /* FIXME: regs->format | regs->vector */ + r->d1 =3D tswapal(env->dregs[1]); + r->d2 =3D tswapal(env->dregs[2]); + r->d3 =3D tswapal(env->dregs[3]); + r->d4 =3D tswapal(env->dregs[4]); + r->d5 =3D tswapal(env->dregs[5]); + r->d6 =3D tswapal(env->dregs[6]); + r->d7 =3D tswapal(env->dregs[7]); + r->a0 =3D tswapal(env->aregs[0]); + r->a1 =3D tswapal(env->aregs[1]); + r->a2 =3D tswapal(env->aregs[2]); + r->a3 =3D tswapal(env->aregs[3]); + r->a4 =3D tswapal(env->aregs[4]); + r->a5 =3D tswapal(env->aregs[5]); + r->a6 =3D tswapal(env->aregs[6]); + r->d0 =3D tswapal(env->dregs[0]); + r->usp =3D tswapal(env->aregs[7]); + r->orig_d0 =3D tswapal(env->dregs[0]); /* FIXME */ + r->sr =3D tswapal(env->sr); + r->pc =3D tswapal(env->pc); + /* FIXME: regs->format | regs->vector */ } --=20 2.43.0