From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58121) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeNsy-0005ZH-Uj for qemu-devel@nongnu.org; Thu, 07 Nov 2013 06:36:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VeNst-0008Ep-0G for qemu-devel@nongnu.org; Thu, 07 Nov 2013 06:36:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:28338) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeNss-0008Ef-N7 for qemu-devel@nongnu.org; Thu, 07 Nov 2013 06:36:22 -0500 Message-ID: <1383823955.2527.49.camel@localhost.localdomain> From: Marcel Apfelbaum Date: Thu, 07 Nov 2013 13:32:35 +0200 In-Reply-To: References: <1383820884-29596-1-git-send-email-marcel.a@redhat.com> <1383820884-29596-2-git-send-email-marcel.a@redhat.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH for-1.7 v2 1/8] exec: declare TARGET_PHYS_ADDR_SPACE_MAX to limit memory regions rendered by exec List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Alexander Graf , Eduardo Habkost , "Michael S. Tsirkin" , Jan Kiszka , QEMU Developers , Luiz Capitulino , Anthony Liguori , Paolo Bonzini , Andreas =?ISO-8859-1?Q?F=E4rber?= On Thu, 2013-11-07 at 10:49 +0000, Peter Maydell wrote: > On 7 November 2013 10:41, Marcel Apfelbaum wrote: > > The page table logic in exec.c assumes > > that memory addresses are at most TARGET_PHYS_ADDR_SPACE_BITS. > > Use TARGET_PHYS_ADDR_SPACE_MAX as max size for memory regions > > rendered by exec. > > > > Signed-off-by: Marcel Apfelbaum > > --- > > include/exec/address-spaces.h | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/include/exec/address-spaces.h b/include/exec/address-spaces.h > > index 3d12cdd..174cc05 100644 > > --- a/include/exec/address-spaces.h > > +++ b/include/exec/address-spaces.h > > @@ -23,6 +23,10 @@ > > > > #ifndef CONFIG_USER_ONLY > > > > +#define TARGET_PHYS_ADDR_SPACE_MAX \ > > + (TARGET_PHYS_ADDR_SPACE_BITS == 64 ? \ > > + UINT64_MAX : (0x1ULL << TARGET_PHYS_ADDR_SPACE_BITS)) > > + > > I think it's worth adding a comment that this is a > size intended for use in memory_region_init() calls and > so follows the odd convention used by that API that > it is a size in bytes with the exception that UINT64_MAX > represents 2^64. I will add the comment in v3. Thanks, Marcel > > (it follows from this that using the #define anywhere > except in a memory_region_init() call is probably a bug) > > -- PMM