From patchwork Thu Jun 5 09:43:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 356274 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8FB5D14009E for ; Thu, 5 Jun 2014 19:43:47 +1000 (EST) Received: from localhost ([::1]:39613 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsUCz-00011E-Pf for incoming@patchwork.ozlabs.org; Thu, 05 Jun 2014 05:43:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49216) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsUCU-0000HV-QY for qemu-devel@nongnu.org; Thu, 05 Jun 2014 05:43:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WsUCO-0008LW-EE for qemu-devel@nongnu.org; Thu, 05 Jun 2014 05:43:10 -0400 Received: from cantor2.suse.de ([195.135.220.15]:39448 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsUCO-0008Kt-7y; Thu, 05 Jun 2014 05:43:04 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 64E2FAB0C; Thu, 5 Jun 2014 09:43:03 +0000 (UTC) From: Alexander Graf To: qemu-ppc@nongnu.org Date: Thu, 5 Jun 2014 11:43:03 +0200 Message-Id: <1401961383-28601-1-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.8.1.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 Cc: Riku Voipio , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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 0af6292..127c565 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -1545,7 +1545,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);