From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LAmGj-0002gY-GZ for qemu-devel@nongnu.org; Thu, 11 Dec 2008 09:11:57 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LAmGh-0002fn-4m for qemu-devel@nongnu.org; Thu, 11 Dec 2008 09:11:56 -0500 Received: from [199.232.76.173] (port=39026 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LAmGg-0002fd-Rf for qemu-devel@nongnu.org; Thu, 11 Dec 2008 09:11:54 -0500 Received: from mx2.redhat.com ([66.187.237.31]:38210) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LAmGg-00063E-Az for qemu-devel@nongnu.org; Thu, 11 Dec 2008 09:11:54 -0500 From: Glauber Costa Date: Thu, 11 Dec 2008 09:11:49 -0500 Message-Id: <1229004710-28331-2-git-send-email-glommer@redhat.com> In-Reply-To: <1229004710-28331-1-git-send-email-glommer@redhat.com> References: <1229004710-28331-1-git-send-email-glommer@redhat.com> Subject: [Qemu-devel] [PATCH 1/2] pass parameter as char. Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: avi@redhat.com, kvm@vger.kernel.org pass parameter to tb_invalidate_phys_page_fast() as a char, that we'll actually transform into an integer. It will make it easier for generator macros to deal with it. Signed-off-by: Glauber Costa --- exec.c | 26 ++++++++++++++++++++++---- 1 files changed, 22 insertions(+), 4 deletions(-) diff --git a/exec.c b/exec.c index 105812f..35e0b8e 100644 --- a/exec.c +++ b/exec.c @@ -997,11 +997,29 @@ void tb_invalidate_phys_page_range(target_phys_addr_t start, target_phys_addr_t #endif } +static inline int size2len(char size) +{ + switch (size) { + case 'b': + return 1; + case 'w': + return 2; + case 'l': + return 4; + } + + /* should never happen */ + fprintf(stderr, "%s: invalid size %d\n", __func__, size); + exit(1); + return -1; +} + /* len must be <= 8 and start must be a multiple of len */ -static inline void tb_invalidate_phys_page_fast(target_phys_addr_t start, int len) +static inline void tb_invalidate_phys_page_fast(target_phys_addr_t start, char size) { PageDesc *p; int offset, b; + int len = size2len(size); #if 0 if (1) { if (loglevel) { @@ -2444,7 +2462,7 @@ static void notdirty_mem_writeb(void *opaque, target_phys_addr_t ram_addr, dirty_flags = phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS]; if (!(dirty_flags & CODE_DIRTY_FLAG)) { #if !defined(CONFIG_USER_ONLY) - tb_invalidate_phys_page_fast(ram_addr, 1); + tb_invalidate_phys_page_fast(ram_addr, 'b'); dirty_flags = phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS]; #endif } @@ -2469,7 +2487,7 @@ static void notdirty_mem_writew(void *opaque, target_phys_addr_t ram_addr, dirty_flags = phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS]; if (!(dirty_flags & CODE_DIRTY_FLAG)) { #if !defined(CONFIG_USER_ONLY) - tb_invalidate_phys_page_fast(ram_addr, 2); + tb_invalidate_phys_page_fast(ram_addr, 'w'); dirty_flags = phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS]; #endif } @@ -2494,7 +2512,7 @@ static void notdirty_mem_writel(void *opaque, target_phys_addr_t ram_addr, dirty_flags = phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS]; if (!(dirty_flags & CODE_DIRTY_FLAG)) { #if !defined(CONFIG_USER_ONLY) - tb_invalidate_phys_page_fast(ram_addr, 4); + tb_invalidate_phys_page_fast(ram_addr, 'l'); dirty_flags = phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS]; #endif } -- 1.5.6.5