From nobody Sat Nov 15 08:32:13 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1753834555324688.327720196378; Tue, 29 Jul 2025 17:15:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uguRT-0001us-O6; Tue, 29 Jul 2025 20:13:11 -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 1uguFD-0001es-A3 for qemu-devel@nongnu.org; Tue, 29 Jul 2025 20:00:31 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uguFB-00042o-F6 for qemu-devel@nongnu.org; Tue, 29 Jul 2025 20:00:30 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-748d982e97cso5672476b3a.1 for ; Tue, 29 Jul 2025 17:00:29 -0700 (PDT) Received: from localhost.localdomain (syn-098-150-199-049.res.spectrum.com. [98.150.199.49]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-764090e178bsm9026087b3a.62.2025.07.29.17.00.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jul 2025 17:00:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1753833628; x=1754438428; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=gmsTdoWMgR5epgRbxoItIZV+Xb1TV36z0k7LZn5QEVI=; b=Mp/iC+ZmqvMAr1t77wA4nZLXHgC397eyze5CWVsG3VuWRLqDfONf82FSAMSbg7lslv UvXbIRAmg/sJj5D+jmwcnInICBLKuOywTrUpcOqkOIlYz9yTQ1jzhibFY6r5fFlD3IcJ cCSnCOgLYKngZ87GAtUptwD/n073MDvQmzqJv0vGZFJ/b6pC9i9OCSdNpoMqJriMkz5X 6W2n9mmzk+wb9PFvZbYWebaxd8TVUefjDUzKyiCcjTkSKa4ARiYEr3dh/nRd9IerYdda vvMXqPuoAhWaFvNGJpCRQJ7HmfiIcMxCwzNwNmLPlcK36VOPVwREgnIHjFfVOMvR/NcA ttoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753833628; x=1754438428; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gmsTdoWMgR5epgRbxoItIZV+Xb1TV36z0k7LZn5QEVI=; b=iQ7JPtU/yAcbcIfMT4YZQ1XFuyioCm0KdJJlG0T2u1BlhxEWdFKZzIawuA3fWmPIRc AeEIdXBausWGn1t8h8szgTOoFDD/KsF4Q3G0mM0iJkdBvN4erRRysg6h2rfYDuk9Z5ht 3SB1Vo8nYyuuV2ZAswsPY5WrDL5p8wCGyeq76oaN4zZbgrEcogGLUimFpnaPh/Un0m89 k+3QKrT0P4vVcKmQYetJWznMUAIEZQhYv3YDBRNnbTJJASE3YsDKjspvKCLJza7Nvqq0 okVB8/pGE/qvUcp7wE5OjeiuA1u1dOD1CHVPKND42DMfcu0YIWZK29YDWQcw7o4yRtVU x+KQ== X-Gm-Message-State: AOJu0YxBIr+Tl3bDvrh56cYrBD48Q0XqPC913IkRm4GBAq/YFlzC7A5q agfw3NY03xSJ32qRXjlhhEFYZMG0IW0k34neCMesvMPAc04Qfg1KlMAID6WFflwOXp29YPbpfLz i/19+ X-Gm-Gg: ASbGncvtsyIzLvKo44C2lgEtJbT2HNu0R6+SRofi24IjeQWTibrF6smLGhA9rydvQJw CY56HiVKLLhoIX2L2OZmhojCIlYEtZh+121oObHy7pTb00JidcAQG0xgQVesMsIzVKUch2NKhJv ZYOllCw5qLzFZyDuEg/3PrrM4K+tbCkxOcnlDF2vIk7rbMpp1Q6K/vSLpsK2b0+ygeGPCyc7FQn 8NiIDSKc8xIbuTvEFIj5IQHRCuzFdyxbUwN5ejkda5YJvGVdUOz1ZUdOv64z/D0fQtNoRCSorOC Gko0+vPSsdW9GGogaSEdfT4/K23synyjMsfto1ujPCQ8/QiLqeGG8JVWJQPXA3S2Z7nWDf+Vrq7 jppMLWJoC3jjit+qmbEHlLL7F09bIZllIbFlDjb2hNlJPhDs2FQw5+MZj/5KqNozoQgXuD1/IXQ sIpFi58GFqWQ== X-Google-Smtp-Source: AGHT+IGG/ER7vyVP2iygVuBjHrJVxm7obbutiJGvskO/RdNXM2G4AsI1CItlMTf42LKgxfTIBLdt3A== X-Received: by 2002:a05:6a00:17a2:b0:748:3385:a4a with SMTP id d2e1a72fcca58-76ab330e62amr1611006b3a.23.1753833627515; Tue, 29 Jul 2025 17:00:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 13/89] linux-user: Move get_elf_platform to {i386, x86_64}/elfload.c Date: Tue, 29 Jul 2025 13:58:46 -1000 Message-ID: <20250730000003.599084-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250730000003.599084-1-richard.henderson@linaro.org> References: <20250730000003.599084-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::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1753834556475116600 Content-Type: text/plain; charset="utf-8" Move get_elf_platform to i386/elfload.c; pass in CPUState. Create a simple get_elf_platform for x86_64. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- linux-user/loader.h | 3 +++ linux-user/elfload.c | 18 ++---------------- linux-user/i386/elfload.c | 13 +++++++++++++ linux-user/x86_64/elfload.c | 5 +++++ 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/linux-user/loader.h b/linux-user/loader.h index 484d20aecd..3bfe47ef22 100644 --- a/linux-user/loader.h +++ b/linux-user/loader.h @@ -102,5 +102,8 @@ abi_ulong get_elf_hwcap(CPUState *cs); abi_ulong get_elf_hwcap2(CPUState *cs); const char *elf_hwcap_str(uint32_t bit); const char *elf_hwcap2_str(uint32_t bit); +#if defined(TARGET_I386) +const char *get_elf_platform(CPUState *cs); +#endif =20 #endif /* LINUX_USER_LOADER_H */ diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 54413bf651..6cbbee6608 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -156,12 +156,12 @@ typedef abi_int target_pid_t; =20 #ifdef TARGET_I386 =20 +#define ELF_PLATFORM get_elf_platform(thread_cpu) + #ifdef TARGET_X86_64 #define ELF_CLASS ELFCLASS64 #define ELF_ARCH EM_X86_64 =20 -#define ELF_PLATFORM "x86_64" - static inline void init_thread(struct target_pt_regs *regs, struct image_i= nfo *infop) { regs->rax =3D 0; @@ -244,22 +244,8 @@ static bool init_guest_commpage(void) #define ELF_CLASS ELFCLASS32 #define ELF_ARCH EM_386 =20 -#define ELF_PLATFORM get_elf_platform() #define EXSTACK_DEFAULT true =20 -static const char *get_elf_platform(void) -{ - static char elf_platform[] =3D "i386"; - int family =3D object_property_get_int(OBJECT(thread_cpu), "family", N= ULL); - if (family > 6) { - family =3D 6; - } - if (family >=3D 3) { - elf_platform[1] =3D '0' + family; - } - return elf_platform; -} - static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop) { diff --git a/linux-user/i386/elfload.c b/linux-user/i386/elfload.c index df171d896a..cc75b4f2d9 100644 --- a/linux-user/i386/elfload.c +++ b/linux-user/i386/elfload.c @@ -9,3 +9,16 @@ abi_ulong get_elf_hwcap(CPUState *cs) { return cpu_env(cs)->features[FEAT_1_EDX]; } + +const char *get_elf_platform(CPUState *cs) +{ + static char elf_platform[] =3D "i386"; + int family =3D object_property_get_int(OBJECT(cs), "family", NULL); + if (family > 6) { + family =3D 6; + } + if (family >=3D 3) { + elf_platform[1] =3D '0' + family; + } + return elf_platform; +} diff --git a/linux-user/x86_64/elfload.c b/linux-user/x86_64/elfload.c index df171d896a..bc40ed8c5b 100644 --- a/linux-user/x86_64/elfload.c +++ b/linux-user/x86_64/elfload.c @@ -9,3 +9,8 @@ abi_ulong get_elf_hwcap(CPUState *cs) { return cpu_env(cs)->features[FEAT_1_EDX]; } + +const char *get_elf_platform(CPUState *cs) +{ + return "x86_64"; +} --=20 2.43.0