From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O3o16-0002yo-Cm for qemu-devel@nongnu.org; Mon, 19 Apr 2010 06:15:48 -0400 Received: from [140.186.70.92] (port=49355 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O3o12-0002wm-6c for qemu-devel@nongnu.org; Mon, 19 Apr 2010 06:15:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O3o0m-0005JZ-2Z for qemu-devel@nongnu.org; Mon, 19 Apr 2010 06:15:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:65290) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O3o0l-0005IM-QY for qemu-devel@nongnu.org; Mon, 19 Apr 2010 06:15:28 -0400 Message-ID: <4BCC2D34.1070401@redhat.com> Date: Mon, 19 Apr 2010 13:15:16 +0300 From: Avi Kivity MIME-Version: 1.0 References: <1271670198-12793-1-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> <1271670198-12793-2-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> In-Reply-To: <1271670198-12793-2-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH v3 1/6] Modify DIRTY_FLAG value and DIRTY_IDX introduce to use as indexes of bit-based phys_ram_dirty. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Yoshiaki Tamura Cc: aliguori@us.ibm.com, mtosatti@redhat.com, qemu-devel@nongnu.org, ohmura.kei@lab.ntt.co.jp On 04/19/2010 12:43 PM, Yoshiaki Tamura wrote: > It uses ffs() to convert DIRTY_FLAG to DIRTY_IDX. > > Signed-off-by: Yoshiaki Tamura > --- > cpu-all.h | 30 ++++++++++++++++++++++++++---- > 1 files changed, 26 insertions(+), 4 deletions(-) > > diff --git a/cpu-all.h b/cpu-all.h > index f8bfa66..8c2d678 100644 > --- a/cpu-all.h > +++ b/cpu-all.h > @@ -37,6 +37,9 @@ > > #include "softfloat.h" > > +/* to use ffs in flag_to_idx() */ > +#include > + > #if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN) > #define BSWAP_NEEDED > #endif > @@ -853,7 +856,6 @@ target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr); > /* memory API */ > > extern int phys_ram_fd; > -extern uint8_t *phys_ram_dirty; > extern ram_addr_t ram_size; > extern ram_addr_t last_ram_offset; > > @@ -878,9 +880,29 @@ extern int mem_prealloc; > /* Set if TLB entry is an IO callback. */ > #define TLB_MMIO (1<< 5) > > -#define VGA_DIRTY_FLAG 0x01 > -#define CODE_DIRTY_FLAG 0x02 > -#define MIGRATION_DIRTY_FLAG 0x08 > +/* Use DIRTY_IDX as indexes of bit-based phys_ram_dirty. */ > +#define MASTER_DIRTY_IDX 0 > +#define VGA_DIRTY_IDX 1 > +#define CODE_DIRTY_IDX 2 > +#define MIGRATION_DIRTY_IDX 3 > +#define NUM_DIRTY_IDX 4 > + > +#define MASTER_DIRTY_FLAG (1<< MASTER_DIRTY_IDX) > +#define VGA_DIRTY_FLAG (1<< VGA_DIRTY_IDX) > +#define CODE_DIRTY_FLAG (1<< CODE_DIRTY_IDX) > +#define MIGRATION_DIRTY_FLAG (1<< MIGRATION_DIRTY_IDX) > + > +extern unsigned long *phys_ram_dirty[NUM_DIRTY_IDX]; > Please modify the bitmap definition in the patch where you start using it; this patch won't compile by itself, breaking bisection. > + > +static inline int flag_to_idx(int flag) > +{ > + return ffs(flag) - 1; > +} > + > +static inline int idx_to_flag(int idx) > +{ > + return 1<< idx; > +} > > These should not be in global scope - it is not clear they refer to dirty bitmaps. Please rename or move to local scope. Alternatively, convert the callers to use *_DIRTY_IDX. -- error compiling committee.c: too many arguments to function