From nobody Wed Nov 5 06:38:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499482352090291.95450185395623; Fri, 7 Jul 2017 19:52:32 -0700 (PDT) Received: from localhost ([::1]:59562 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTfrC-0002PX-Lb for importer@patchew.org; Fri, 07 Jul 2017 22:52:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43603) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTfpf-0001Sb-9C for qemu-devel@nongnu.org; Fri, 07 Jul 2017 22:50:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dTfpe-0004xX-CW for qemu-devel@nongnu.org; Fri, 07 Jul 2017 22:50:55 -0400 Received: from mail-qk0-x244.google.com ([2607:f8b0:400d:c09::244]:33295) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dTfpe-0004xM-7x; Fri, 07 Jul 2017 22:50:54 -0400 Received: by mail-qk0-x244.google.com with SMTP id p21so6558356qke.0; Fri, 07 Jul 2017 19:50:54 -0700 (PDT) Received: from bigtime.twiddle.net.com (rrcs-66-91-136-156.west.biz.rr.com. [66.91.136.156]) by smtp.gmail.com with ESMTPSA id q90sm3793925qki.11.2017.07.07.19.50.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Jul 2017 19:50:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=BHq3V6wgsHmxbKumrTk0927GbDnWp342NVcNICOr4+M=; b=pRjLOHuesPhQ/syuSWajWtChdAID5lfv6N35L+WSU8DTvUlfghVBSHViXKi9eHu7oX Afqyhl+7yx10EJBvcg7GY/b+7eDcoAbuoxGpwyN7VTXTx8/o3MPytZEauX8ejCkXwhle PyNfEa75eM+gu5rPARQTTJa8NQMVwCuZfUfpmqAu+xVxq6C1iRruOBGrRZmqLCKRtU1L xQ//Ly1A8qMJTOv3QlMJHjXvD8YB+/7olGEE72e/krbILDXlefCjDmIYFTTR8yX2n15J Ql/ZBKwQHPaXnBQR9CFciG28lFPPvF6BlL1o78YXTw1ex1yv2435j+hQOWGqckrrYWXK 98xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=BHq3V6wgsHmxbKumrTk0927GbDnWp342NVcNICOr4+M=; b=fCuAr3bIEUMRFQX2acnqR1XKZ2OopCx4pjvexK6/Do9Wz9gCC0do6tZbAxMFBO8B7o ZDJ1YVHdM70tNgcC+TZXIas+iB3JVau3c+ZT7Z2o26o3hG8XoAeXFF8WRz1Pb+d8kU81 iihJnTKSh1zuWtj/rROxx77IX3IZIxWno3duNXWO/5/9k4MjimQlqBZr++Vt7OLlKXPR RmP/qANVRNE1C6uoegEg2pHVvQTwQqC8gxzWR1x1hmJvAYmJYvLf4g1CIEhr7tXbTJt1 ICPANU2mNpW0KcMe/4Q4PjmkrGNNKz4kD8KTas577yq3fCXqWYq7CPrmqVZGgmVV/wUR givg== X-Gm-Message-State: AKS2vOwbqO+NoiK3cGV39JuHHZo1r8f5vyMwczEenqrs7JVuSApbMkBC yMz8oU8twLAYkZsJNsU= X-Received: by 10.55.5.135 with SMTP id 129mr72239118qkf.184.1499482253421; Fri, 07 Jul 2017 19:50:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 7 Jul 2017 16:50:28 -1000 Message-Id: <20170708025030.15845-2-rth@twiddle.net> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170708025030.15845-1-rth@twiddle.net> References: <20170708025030.15845-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::244 Subject: [Qemu-devel] [PATCH 1/3] tcg: Fix off-by-one in assert in page_set_flags X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: aurelien@aurel32.net, riku.voipio@iki.fi, laurent@vivier.eu, qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Most of the users of page_set_flags offset (page, page + len) as the end points. One might consider this an error, since the other users do supply an endpoint as the last byte of the region. However, the first thing that page_set_flags does is round end UP to the start of the next page. Which means computing page + len - 1 is in the end pointless. Therefore, accept this usage and do not assert when given the exact size of the vm as the endpoint. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- accel/tcg/translate-all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index dfb9f0d..57578a4 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2068,7 +2068,7 @@ void page_set_flags(target_ulong start, target_ulong = end, int flags) guest address space. If this assert fires, it probably indicates a missing call to h2g_valid. */ #if TARGET_ABI_BITS > L1_MAP_ADDR_SPACE_BITS - assert(end < ((target_ulong)1 << L1_MAP_ADDR_SPACE_BITS)); + assert(end <=3D ((target_ulong)1 << L1_MAP_ADDR_SPACE_BITS)); #endif assert(start < end); assert_memory_lock(); --=20 2.9.4 From nobody Wed Nov 5 06:38:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499482363582674.9028541339233; Fri, 7 Jul 2017 19:52:43 -0700 (PDT) Received: from localhost ([::1]:59563 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTfrO-0002YB-Bg for importer@patchew.org; Fri, 07 Jul 2017 22:52:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43663) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTfpj-0001W3-U6 for qemu-devel@nongnu.org; Fri, 07 Jul 2017 22:51:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dTfpi-00050b-PT for qemu-devel@nongnu.org; Fri, 07 Jul 2017 22:51:00 -0400 Received: from mail-qk0-x243.google.com ([2607:f8b0:400d:c09::243]:33297) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dTfpi-00050M-Ki; Fri, 07 Jul 2017 22:50:58 -0400 Received: by mail-qk0-x243.google.com with SMTP id p21so6558521qke.0; Fri, 07 Jul 2017 19:50:58 -0700 (PDT) Received: from bigtime.twiddle.net.com (rrcs-66-91-136-156.west.biz.rr.com. [66.91.136.156]) by smtp.gmail.com with ESMTPSA id q90sm3793925qki.11.2017.07.07.19.50.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Jul 2017 19:50:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=vK/P+XmBotxamGKAbyPmNTlVdfzn5UKNPl+nyZGjC6Q=; b=ZoQOfS2vK+BHjZHNTYl+OUbenUNnmHAO4m2MeuL0b1FnfmyYhnNVXM3D7AKUq6mVxh LcGld8B3/BIwG6cGkrS2IKHo9SD00Uav038zw6aKhPlpO+idgJyYtqlwOD+PMXHIdwRE fQwiwtG4FcYYS4anWDZoi/bzFVipPQozUwKgRYZpA7ylxavm8nfc2ucIafaxGe04O631 SSqQIhf2FoxgK9X5d8rOgjmWioWKkwNbsMdq6arGEqotEgHiM0BMSzUtSo3e0p9e6sXj UHeFxf1ZRx2teQXYCoX3IKz6jbupRYvc2AU2O8jpb726YISaNm70jCti9yW1wXL8ozw9 QGdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=vK/P+XmBotxamGKAbyPmNTlVdfzn5UKNPl+nyZGjC6Q=; b=WWn2/f4EwTSyagihpHEB3E3OBhqJknUCdF08UDMfwq77zVxC6FEpkzLPq3a0STWB49 YxAslfNzQZdDb1qtMH2H7AwncgUxR6MPH50IL2F6417bzjxwyybkcYgpA5lflx4eUeXn xrIEVQsJTjpc1Ct5PJDKDRpjQFJ2GANn7is60FQVWncL5MxKx+2paarHHsISDXI9NXtl 06Kn7VhVxOPSBAVuIEXlzK/B9I4yjLZDDbCuFGp2hsV5DneqwffwjZlcIRjmV5EUf2xS 4RASmoF1ZlLkLUFF2XghXqbGUUOVS2pz/gKdkFpy6ffqALR0jjz6l3Txy5n352sXFbAD I/sQ== X-Gm-Message-State: AKS2vOx4VdXzxd38xhZNubAZNttHU4+asg9C1cJ5rDfK08CqE3FJZaYD hrjMF4oPhmC6/Psk3VI= X-Received: by 10.55.1.65 with SMTP id 62mr65811070qkb.210.1499482257754; Fri, 07 Jul 2017 19:50:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 7 Jul 2017 16:50:29 -1000 Message-Id: <20170708025030.15845-3-rth@twiddle.net> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170708025030.15845-1-rth@twiddle.net> References: <20170708025030.15845-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::243 Subject: [Qemu-devel] [PATCH 2/3] linux-user: Tidy and enforce reserved_va initialization X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: aurelien@aurel32.net, riku.voipio@iki.fi, laurent@vivier.eu, qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We had a check using TARGET_VIRT_ADDR_SPACE_BITS to make sure that the allocation coming in from the command-line option was not too large, but that didn't include target-specific knowledge about other restrictions on user-space. Remove several target-specific hacks in linux-user/main.c. For MIPS and Nios, we can replace them with proper adjustments to the respective target's TARGET_VIRT_ADDR_SPACE_BITS definition. For ARM, we had no existing ifdef but I suspect that the current default value of 0xf7000000 was chosen with this in mind. Define a workable value in linux-user/arm/, and also document why the special case is required. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- linux-user/arm/target_cpu.h | 4 ++++ target/mips/mips-defs.h | 6 +++++- target/nios2/cpu.h | 6 +++++- linux-user/main.c | 38 +++++++++++++++++++++++++------------- 4 files changed, 39 insertions(+), 15 deletions(-) diff --git a/linux-user/arm/target_cpu.h b/linux-user/arm/target_cpu.h index d888219..c4f79eb 100644 --- a/linux-user/arm/target_cpu.h +++ b/linux-user/arm/target_cpu.h @@ -19,6 +19,10 @@ #ifndef ARM_TARGET_CPU_H #define ARM_TARGET_CPU_H =20 +/* We need to be able to map the commpage. + See validate_guest_space in linux-user/elfload.c. */ +#define MAX_RESERVED_VA 0xfff00000ul + static inline void cpu_clone_regs(CPUARMState *env, target_ulong newsp) { if (newsp) { diff --git a/target/mips/mips-defs.h b/target/mips/mips-defs.h index 047554e..d239069 100644 --- a/target/mips/mips-defs.h +++ b/target/mips/mips-defs.h @@ -15,7 +15,11 @@ #else #define TARGET_LONG_BITS 32 #define TARGET_PHYS_ADDR_SPACE_BITS 40 -#define TARGET_VIRT_ADDR_SPACE_BITS 32 +# ifdef CONFIG_USER_ONLY +# define TARGET_VIRT_ADDR_SPACE_BITS 31 +# else +# define TARGET_VIRT_ADDR_SPACE_BITS 32 +#endif #endif =20 /* Masks used to mark instructions to indicate which ISA level they diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h index 13931f3..da3f637 100644 --- a/target/nios2/cpu.h +++ b/target/nios2/cpu.h @@ -227,7 +227,11 @@ qemu_irq *nios2_cpu_pic_init(Nios2CPU *cpu); void nios2_check_interrupts(CPUNios2State *env); =20 #define TARGET_PHYS_ADDR_SPACE_BITS 32 -#define TARGET_VIRT_ADDR_SPACE_BITS 32 +#ifdef CONFIG_USER_ONLY +# define TARGET_VIRT_ADDR_SPACE_BITS 31 +#else +# define TARGET_VIRT_ADDR_SPACE_BITS 32 +#endif =20 #define cpu_init(cpu_model) CPU(cpu_nios2_init(cpu_model)) =20 diff --git a/linux-user/main.c b/linux-user/main.c index ad03c9e..e000533 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -60,23 +60,38 @@ do { = \ } \ } while (0) =20 -#if (TARGET_LONG_BITS =3D=3D 32) && (HOST_LONG_BITS =3D=3D 64) /* * When running 32-on-64 we should make sure we can fit all of the possible * guest address space into a contiguous chunk of virtual host memory. * * This way we will never overlap with our own libraries or binaries or st= ack * or anything else that QEMU maps. + * + * Many cpus reserve the high bit (or more than one for some 64-bit cpus) + * of the address for the kernel. Some cpus rely on this and user space + * uses the high bit(s) for pointer tagging and the like. For them, we + * must preserve the expected address space. */ -# if defined(TARGET_MIPS) || defined(TARGET_NIOS2) -/* - * MIPS only supports 31 bits of virtual address space for user space. - * Nios2 also only supports 31 bits. - */ -unsigned long reserved_va =3D 0x77000000; +#ifndef MAX_RESERVED_VA +# if HOST_LONG_BITS > TARGET_VIRT_ADDR_SPACE_BITS +# if TARGET_VIRT_ADDR_SPACE_BITS =3D=3D 32 && \ + (TARGET_LONG_BITS =3D=3D 32 || defined(TARGET_ABI32)) +/* There are a number of places where we assign reserved_va to a variable + of type abi_ulong and expect it to fit. Avoid the last page. */ +# define MAX_RESERVED_VA (0xfffffffful & TARGET_PAGE_MASK) +# else +# define MAX_RESERVED_VA (1ul << TARGET_VIRT_ADDR_SPACE_BITS) +# endif # else -unsigned long reserved_va =3D 0xf7000000; +# define MAX_RESERVED_VA 0 # endif +#endif + +/* That said, reserving *too* much vm space via mmap can run into problems + with rlimits, oom due to page table creation, etc. We will still try i= t, + if directed by the command-line option, but not by default. */ +#if HOST_LONG_BITS =3D=3D 64 && TARGET_VIRT_ADDR_SPACE_BITS <=3D 32 +unsigned long reserved_va =3D MAX_RESERVED_VA; #else unsigned long reserved_va; #endif @@ -3975,11 +3990,8 @@ static void handle_arg_reserved_va(const char *arg) unsigned long unshifted =3D reserved_va; p++; reserved_va <<=3D shift; - if (((reserved_va >> shift) !=3D unshifted) -#if HOST_LONG_BITS > TARGET_VIRT_ADDR_SPACE_BITS - || (reserved_va > (1ul << TARGET_VIRT_ADDR_SPACE_BITS)) -#endif - ) { + if (reserved_va >> shift !=3D unshifted + || (MAX_RESERVED_VA && reserved_va > MAX_RESERVED_VA)) { fprintf(stderr, "Reserved virtual address too big\n"); exit(EXIT_FAILURE); } --=20 2.9.4 From nobody Wed Nov 5 06:38:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499482461091147.76468095299367; Fri, 7 Jul 2017 19:54:21 -0700 (PDT) Received: from localhost ([::1]:59569 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTfsx-00041o-Oz for importer@patchew.org; Fri, 07 Jul 2017 22:54:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43702) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTfpo-0001aZ-Ld for qemu-devel@nongnu.org; Fri, 07 Jul 2017 22:51:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dTfpm-00053A-KN for qemu-devel@nongnu.org; Fri, 07 Jul 2017 22:51:04 -0400 Received: from mail-qt0-x243.google.com ([2607:f8b0:400d:c0d::243]:34402) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dTfpm-000531-Fq; Fri, 07 Jul 2017 22:51:02 -0400 Received: by mail-qt0-x243.google.com with SMTP id m54so6452869qtb.1; Fri, 07 Jul 2017 19:51:02 -0700 (PDT) Received: from bigtime.twiddle.net.com (rrcs-66-91-136-156.west.biz.rr.com. [66.91.136.156]) by smtp.gmail.com with ESMTPSA id q90sm3793925qki.11.2017.07.07.19.50.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Jul 2017 19:51:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=x0B4mLaLsw+VQCgKtBesMCfDp7aZy9g1E3kvsYp90rQ=; b=VY2W6oFufWceuAYVeuns0aUvdvku568ir8jnmctnVPp7VIIc5XiLr/KZCg5jy7iheJ ctyR68TbBD3DOyBUSk+l7Sh2OIaDZnwd1zMz2qDcr5FlbkbfpVZxm+35GYuAd1LV7Edv h/GKghjPmMATAM0QI0jEKjHWCcD9iytNfLL6IVAJI5FPA+Qfy2uWkX+fS3bYtBqnp0J2 jqk3qUYI6X6So7mOloiuvomrwZl72Raz424ZmhdmaT6N8DtJRQ3Osbg66GPynt5Zw8Na 8FfgRnc60PeiFAy2GjUNF6f09AU51/xBqXJjTeXZv4/tEIDvdWAYbgzrDfoHfJD34UHp 65gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=x0B4mLaLsw+VQCgKtBesMCfDp7aZy9g1E3kvsYp90rQ=; b=nucCpGcnk07aTECFuOmes2LOHteqPlXt2AvZfu2lXQdRujDcoZHYTeF+fUiPuyYzx7 XRNiNYLw+4N3GVmy4uM6bSG1CONQDLRTmEUOvcDjgPxbsemug7oQqI10xJZI/z/UGLjc PB19pnUAnAmVK36aApW21l+yoA+Qy8QRercuCsohRV6mLOq7GSefDx7xYHRz5o0N/XOi 4c/Ynd/SBqGUgX9aTlDIQK2m47F5ep0YmnNB0NZks6pcxk9diJTMzenZqOXZYdW9fPWa kBWSHJ2c18h+8o6fMhGXOw8SR3oCZa+jFfq3HtxpDw+fsLN8V+NE7+vrot6Jjmi4yL8a VlYg== X-Gm-Message-State: AKS2vOzpVbd5T1TAcNAWKt8AciFXZEKpEAM1Nw2vE6Ta4KGDnxAW4XCp ENJ2xCxDAkseEEQkJWA= X-Received: by 10.200.50.249 with SMTP id a54mr69633899qtb.91.1499482261748; Fri, 07 Jul 2017 19:51:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 7 Jul 2017 16:50:30 -1000 Message-Id: <20170708025030.15845-4-rth@twiddle.net> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170708025030.15845-1-rth@twiddle.net> References: <20170708025030.15845-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::243 Subject: [Qemu-devel] [PATCH 3/3] linux-user/sh4: Reduce TARGET_VIRT_ADDR_SPACE_BITS to 31 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: aurelien@aurel32.net, riku.voipio@iki.fi, laurent@vivier.eu, qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The real kernel has TASK_SIZE as 0x7c000000, due to quirks with a couple of SH parts. But nominally user-space is limited to 2GB. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/sh4/cpu.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/target/sh4/cpu.h b/target/sh4/cpu.h index e3abb6a..3121d1e 100644 --- a/target/sh4/cpu.h +++ b/target/sh4/cpu.h @@ -45,7 +45,11 @@ #define TARGET_PAGE_BITS 12 /* 4k XXXXX */ =20 #define TARGET_PHYS_ADDR_SPACE_BITS 32 -#define TARGET_VIRT_ADDR_SPACE_BITS 32 +#ifdef CONFIG_USER_ONLY +# define TARGET_VIRT_ADDR_SPACE_BITS 31 +#else +# define TARGET_VIRT_ADDR_SPACE_BITS 32 +#endif =20 #define SR_MD 30 #define SR_RB 29 --=20 2.9.4