From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:39853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhcLX-0006ZA-Tz for qemu-devel@nongnu.org; Wed, 29 May 2013 05:07:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UhcLT-00028A-B6 for qemu-devel@nongnu.org; Wed, 29 May 2013 05:07:03 -0400 Received: from mail-qe0-f46.google.com ([209.85.128.46]:47969) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhcLT-000286-82 for qemu-devel@nongnu.org; Wed, 29 May 2013 05:06:59 -0400 Received: by mail-qe0-f46.google.com with SMTP id 1so4787863qee.19 for ; Wed, 29 May 2013 02:06:59 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <51A5C525.3080208@redhat.com> Date: Wed, 29 May 2013 11:06:45 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1369793469-30883-1-git-send-email-qemulist@gmail.com> <1369793469-30883-2-git-send-email-qemulist@gmail.com> In-Reply-To: <1369793469-30883-2-git-send-email-qemulist@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v1 1/6] mem: change variable to macro List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liu Ping Fan Cc: qemu-devel@nongnu.org, Anthony Liguori Il 29/05/2013 04:11, Liu Ping Fan ha scritto: > From: Liu Ping Fan > > The secions like phys_section_unassigned always has fixed address > in phys_sections, make them declared as macro, so we can use them > when having more than one phys_sections, ie, more than one dispatch > context. > > Signed-off-by: Liu Ping Fan > --- > exec.c | 22 ++++++++++++++-------- > 1 files changed, 14 insertions(+), 8 deletions(-) > > diff --git a/exec.c b/exec.c > index 281c007..6934c2d 100644 > --- a/exec.c > +++ b/exec.c > @@ -82,10 +82,10 @@ int use_icount; > > static MemoryRegionSection *phys_sections; > static unsigned phys_sections_nb, phys_sections_nb_alloc; > -static uint16_t phys_section_unassigned; > -static uint16_t phys_section_notdirty; > -static uint16_t phys_section_rom; > -static uint16_t phys_section_watch; > +#define phys_section_unassigned 0 > +#define phys_section_notdirty 1 > +#define phys_section_rom 2 > +#define phys_section_watch 3 Please make these uppercase. Otherwise, Reviewed-by: Paolo Bonzini > /* Simple allocator for PhysPageEntry nodes */ > static PhysPageEntry (*phys_map_nodes)[L2_SIZE]; > @@ -1747,11 +1747,17 @@ static void mem_begin(MemoryListener *listener) > > static void core_begin(MemoryListener *listener) > { > + uint16_t n; > + > phys_sections_clear(); > - phys_section_unassigned = dummy_section(&io_mem_unassigned); > - phys_section_notdirty = dummy_section(&io_mem_notdirty); > - phys_section_rom = dummy_section(&io_mem_rom); > - phys_section_watch = dummy_section(&io_mem_watch); > + n = dummy_section(&io_mem_unassigned); > + assert(phys_section_unassigned == n); > + n = dummy_section(&io_mem_notdirty); > + assert(phys_section_notdirty == n); > + n = dummy_section(&io_mem_rom); > + assert(phys_section_rom == n); > + n = dummy_section(&io_mem_watch); > + assert(phys_section_watch == n); > } > > static void tcg_commit(MemoryListener *listener) >