From nobody Thu Nov 28 14:47:18 2024 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=1691293295; cv=none; d=zohomail.com; s=zohoarc; b=X+LflP9RhGNrVUPZb7B95aV1eoxV4L6UoPOgIaN5TIWNMOQp1BI9rZtXKliPzDnxqD3fe2XLJyT8AKLAh96oG98mWNLVhdm7vQt1FFqPE9f+tJQpI3AIXyv58GM5tZC7R4DuKEgAqkQhUj3dZs1adka266p0ceTtWdI2KmwJ5eo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691293295; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0VLnmjiDjAi6Gl+LJx+pmU5KrGv5xMTSD4fN49XrjM0=; b=EQS5imw08R08ku3qvrA7858VtA7QmuSsytsUyIclfAQE52ctjbN1Z0w/hhdXQVZ/FJS8JrB9dH+LqAQsWFTqYBtHRNyYJzUWhvLH802ot2NtfY3FQcN0RB/gbLRNX3QNz6T6pqs6uDnuNItHIWKb1ORrT0oyORHtn1uotO1dQ3U= 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 1691293295211508.6309708081675; Sat, 5 Aug 2023 20:41:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qSUaH-0003jU-53; Sat, 05 Aug 2023 23:37:37 -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 1qSUaF-0003ih-OY for qemu-devel@nongnu.org; Sat, 05 Aug 2023 23:37:35 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qSUaE-0007af-5t for qemu-devel@nongnu.org; Sat, 05 Aug 2023 23:37:35 -0400 Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-564af1b3a9fso1651820a12.1 for ; Sat, 05 Aug 2023 20:37:33 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:9454:a46f:1c22:a7c6]) by smtp.gmail.com with ESMTPSA id a5-20020a17090a740500b00262e604724dsm6306451pjg.50.2023.08.05.20.37.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Aug 2023 20:37:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691293053; x=1691897853; 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=0VLnmjiDjAi6Gl+LJx+pmU5KrGv5xMTSD4fN49XrjM0=; b=k86kupewmSW1Nd86OOjC3/oRzVdxXYuhjhYYhIkfjZdxm2OK0pIciX5x/6LFy5F/Cx eBzoQpzclceV7WYJjWje3diFdSqc7ZXxcAUrBR+gf78QqXJl5JxdDju+FjcwywVLqnER FPlU3KsZElM/WFzMX5rutTI35K3oJFrYo7MnLrOpGOgqJ00mCoto8MRqcFnhhGX1431X Amv0lxJ4+3oaBkzvXqwbCWby2fUNkLTUp2HW1KLdL2ORpdVTMqCTKBsMDz4x0g2gptT2 zGPmCRrH+RdgpJlfCI5rtjDo2lhWzDyN1m/MvyM8Q2ogeXY/hVHazrzmM9ZpW7CAWQ6G y2bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691293053; x=1691897853; 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=0VLnmjiDjAi6Gl+LJx+pmU5KrGv5xMTSD4fN49XrjM0=; b=Oq1CGL3NtTUtmuqj09mtacG+WZH4Gf2gavSeoQgPa/vk99IsfW+6MUAe49ckGWx5tk vZ4/kNd0esBe3A1MrlaCBn72hf2YrqCUwx1I2RSDnTFtNZeNOvdiPtv9zuDD5/J7WkeB MakNGCxmenHfxMI/drrKakHv7lSwt88tr/xYeeC4jclc7wQvRtEzXGF8pVhOGmYQv3xi XjalJf1Q276UqFw7OJLR2BdaQELjDNnO9QR91jCBXaMxBXacsJn8z930UlBvyZsikXaR jUYC6AEkx4Q6aAqaaZwxCV9R0WYb5QW9cuRtVVyya8nNUKEkgNfSJJEhmfxgrIl5n5s3 PgJA== X-Gm-Message-State: AOJu0Yw4Bc1XEcBY50d51rHe5FMaYktqGOHgi/if7mmzvuN+qYnKSuLr fZVZZsDG9E7MgSeIGSYqDS8BeoMUfrlPyuN2wYw= X-Google-Smtp-Source: AGHT+IGFTSDjSaDLm14v3AZ6e9UqP06M++PP4qENV3E6FEIQ1KEduobOtmSTjZniaqppzpZE4gQHfQ== X-Received: by 2002:a17:90a:fad:b0:263:161c:9e9c with SMTP id 42-20020a17090a0fad00b00263161c9e9cmr4614220pjz.12.1691293052938; Sat, 05 Aug 2023 20:37:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Helge Deller , Akihiko Odaki Subject: [PULL 20/24] linux-user: Do not adjust image mapping for host page size Date: Sat, 5 Aug 2023 20:37:11 -0700 Message-Id: <20230806033715.244648-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230806033715.244648-1-richard.henderson@linaro.org> References: <20230806033715.244648-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::533; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x533.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: 1691293296080100001 Content-Type: text/plain; charset="utf-8" Remove TARGET_ELF_EXEC_PAGESIZE, and 3 other TARGET_ELF_PAGE* macros based off of that. Rely on target_mmap to handle guest vs host page size mismatch. Tested-by: Helge Deller Reviewed-by: Helge Deller Reviewed-by: Akihiko Odaki Signed-off-by: Richard Henderson --- linux-user/elfload.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index fa0c9ace8e..e853a4ab33 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -1959,15 +1959,6 @@ struct exec #define ZMAGIC 0413 #define QMAGIC 0314 =20 -/* Necessary parameters */ -#define TARGET_ELF_EXEC_PAGESIZE \ - (((eppnt->p_align & ~qemu_host_page_mask) !=3D 0) ? \ - TARGET_PAGE_SIZE : MAX(qemu_host_page_size, TARGET_PAGE_SIZE)) -#define TARGET_ELF_PAGELENGTH(_v) ROUND_UP((_v), TARGET_ELF_EXEC_PAGESIZE) -#define TARGET_ELF_PAGESTART(_v) ((_v) & \ - ~(abi_ulong)(TARGET_ELF_EXEC_PAGESIZE-1)) -#define TARGET_ELF_PAGEOFFSET(_v) ((_v) & (TARGET_ELF_EXEC_PAGESIZE-1)) - #define DLINFO_ITEMS 16 =20 static inline void memcpy_fromfs(void * to, const void * from, unsigned lo= ng n) @@ -3240,8 +3231,8 @@ static void load_elf_image(const char *image_name, in= t image_fd, } =20 vaddr =3D load_bias + eppnt->p_vaddr; - vaddr_po =3D TARGET_ELF_PAGEOFFSET(vaddr); - vaddr_ps =3D TARGET_ELF_PAGESTART(vaddr); + vaddr_po =3D vaddr & ~TARGET_PAGE_MASK; + vaddr_ps =3D vaddr & TARGET_PAGE_MASK; =20 vaddr_ef =3D vaddr + eppnt->p_filesz; vaddr_em =3D vaddr + eppnt->p_memsz; @@ -3251,7 +3242,7 @@ static void load_elf_image(const char *image_name, in= t image_fd, * but no backing file segment. */ if (eppnt->p_filesz !=3D 0) { - vaddr_len =3D TARGET_ELF_PAGELENGTH(eppnt->p_filesz + vadd= r_po); + vaddr_len =3D eppnt->p_filesz + vaddr_po; error =3D target_mmap(vaddr_ps, vaddr_len, elf_prot, MAP_PRIVATE | MAP_FIXED, image_fd, eppnt->p_offset - vaddr_po); @@ -3267,7 +3258,7 @@ static void load_elf_image(const char *image_name, in= t image_fd, zero_bss(vaddr_ef, vaddr_em, elf_prot); } } else if (eppnt->p_memsz !=3D 0) { - vaddr_len =3D TARGET_ELF_PAGELENGTH(eppnt->p_memsz + vaddr= _po); + vaddr_len =3D eppnt->p_memsz + vaddr_po; error =3D target_mmap(vaddr_ps, vaddr_len, elf_prot, MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOU= S, -1, 0); --=20 2.34.1