From patchwork Mon Jun 9 12:46:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 31560 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f199.google.com (mail-ie0-f199.google.com [209.85.223.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DE3E320675 for ; Mon, 9 Jun 2014 12:56:33 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id rl12sf35796153iec.2 for ; Mon, 09 Jun 2014 05:56:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=JbsJH/iil9mzTAmt183fge9c4OrxFRg+DGwk8cDcexY=; b=YuQbu/XbfRuFfwlunx+e1wmUf1JkGAe4aPS/5tnzO9aen0mFaf1zDuWJKwVB7R3xIm t1+/OLv4DrmCln6cqnK5ifAYUWcwKTByLIkuqxx9Jfw3r3Rw+1TsbQHYnqOj6ithjklm QdkDIqztBN5ylTzYoooEajLHT3TgCosdX1YQacSLo15XhcgaDh58zIIsbDrpA0AutpBr 4EdkCeDm3mjdwjWXnSZb8tBVS0Fz8SAW+LXFKITHM++GlXwBvvc6IRD0+OKG70GW1u7E jgjRMYj6WZozrV6Kl7tuZF99Vf+bj2ljKooXKrMYpPejwkdwHhzF3QnM2I1s041ByE4W nDcQ== X-Gm-Message-State: ALoCoQlWN5hO6wBufT4pdOl8+frdYTebmNHV6bLmLjV8Rpapq5rz07M7pOckc/N15e13JEp3NVIo X-Received: by 10.50.12.106 with SMTP id x10mr541940igb.1.1402318593371; Mon, 09 Jun 2014 05:56:33 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.87.141 with SMTP id r13ls1620234qgd.98.gmail; Mon, 09 Jun 2014 05:56:33 -0700 (PDT) X-Received: by 10.58.132.41 with SMTP id or9mr26075139veb.5.1402318593070; Mon, 09 Jun 2014 05:56:33 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id u4si10571374vcs.52.2014.06.09.05.56.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 09 Jun 2014 05:56:33 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id hq11so6234795vcb.12 for ; Mon, 09 Jun 2014 05:56:33 -0700 (PDT) X-Received: by 10.58.220.230 with SMTP id pz6mr5632925vec.9.1402318592993; Mon, 09 Jun 2014 05:56:32 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.54.6 with SMTP id vs6csp143795vcb; Mon, 9 Jun 2014 05:56:32 -0700 (PDT) X-Received: by 10.140.41.166 with SMTP id z35mr30532550qgz.20.1402318592154; Mon, 09 Jun 2014 05:56:32 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id i9si23583849qaf.55.2014.06.09.05.56.32 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 09 Jun 2014 05:56:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:60937 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wtz7n-0002vb-TH for patch@linaro.org; Mon, 09 Jun 2014 08:56:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44959) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WtyyV-0005cd-5D for qemu-devel@nongnu.org; Mon, 09 Jun 2014 08:47:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WtyyN-0007iP-JW for qemu-devel@nongnu.org; Mon, 09 Jun 2014 08:46:55 -0400 Received: from afflict.kos.to ([92.243.29.197]:40167) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WtyyN-0007hP-C7 for qemu-devel@nongnu.org; Mon, 09 Jun 2014 08:46:47 -0400 Received: from afflict.kos.to (afflict [92.243.29.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id 4A10F2658D; Mon, 9 Jun 2014 14:46:45 +0200 (CEST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Mon, 9 Jun 2014 15:46:41 +0300 Message-Id: X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 92.243.29.197 Cc: peter.maydell@linaro.org, Alexander Graf Subject: [Qemu-devel] [PULL 16/18] linux-user: Tell guest about big host page sizes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: riku.voipio@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Alexander Graf We tell the guest its page size via AUX vectors. The guest process then uses this page size as information on which boundaries it can mmap() things. However, if the host has a bigger page size granularity than the guest, it can not fulfill these mmap() requests - which falls apart when MAP_FIXED is passed to mmap. So in that case, let the guest know that we're running on a bigger page size granularity than the target would require. This fixes running qemu-ppc (TARGET_PAGE_SIZE=4k) on a 64k page size ppc64 host for me. Signed-off-by: Alexander Graf Reviewed-by: Richard Henderson Signed-off-by: Riku Voipio --- linux-user/elfload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 995f999..03a8719 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -1531,7 +1531,7 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc, NEW_AUX_ENT(AT_PHDR, (abi_ulong)(info->load_addr + exec->e_phoff)); NEW_AUX_ENT(AT_PHENT, (abi_ulong)(sizeof (struct elf_phdr))); NEW_AUX_ENT(AT_PHNUM, (abi_ulong)(exec->e_phnum)); - NEW_AUX_ENT(AT_PAGESZ, (abi_ulong)(TARGET_PAGE_SIZE)); + NEW_AUX_ENT(AT_PAGESZ, (abi_ulong)(MAX(TARGET_PAGE_SIZE, getpagesize()))); NEW_AUX_ENT(AT_BASE, (abi_ulong)(interp_info ? interp_info->load_addr : 0)); NEW_AUX_ENT(AT_FLAGS, (abi_ulong)0); NEW_AUX_ENT(AT_ENTRY, info->entry);