From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JweAA-0005Z0-R3 for qemu-devel@nongnu.org; Thu, 15 May 2008 10:10:31 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JweA9-0005Xp-Fd for qemu-devel@nongnu.org; Thu, 15 May 2008 10:10:29 -0400 Received: from [199.232.76.173] (port=37558 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JweA9-0005XZ-37 for qemu-devel@nongnu.org; Thu, 15 May 2008 10:10:29 -0400 Received: from mx1.redhat.com ([66.187.233.31]:35976) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JweA8-0003DQ-GE for qemu-devel@nongnu.org; Thu, 15 May 2008 10:10:28 -0400 From: Glauber Costa Date: Thu, 15 May 2008 11:09:31 -0300 Message-Id: <12108606151640-git-send-email-gcosta@redhat.com> In-Reply-To: <12108606121918-git-send-email-gcosta@redhat.com> References: <12108605731805-git-send-email-gcosta@redhat.com> <12108605813076-git-send-email-gcosta@redhat.com> <12108605843020-git-send-email-gcosta@redhat.com> <12108605883967-git-send-email-gcosta@redhat.com> <12108605912878-git-send-email-gcosta@redhat.com> <121086059420-git-send-email-gcosta@redhat.com> <12108605981240-git-send-email-gcosta@redhat.com> <12108606012733-git-send-email-gcosta@redhat.com> <12108606053604-git-send-email-gcosta@redhat.com> <12108606081482-git-send-email-gcosta@redhat.com> <12108606121918-git-send-email-gcosta@redhat.com> Subject: [Qemu-devel] [PATCH 11/13] [PATCH] wrap modify_page through accel calls 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: kvm-devel@lists.sourceforge.net --- exec-all.h | 8 +++++++- exec.c | 24 +++++++++--------------- kqemu.c | 26 +++++++++++++++----------- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/exec-all.h b/exec-all.h index ed96a22..04112e0 100644 --- a/exec-all.h +++ b/exec-all.h @@ -586,6 +586,7 @@ typedef struct QEMUAccel { int (*info)(CPUState *env, char *buf); int (*profile)(CPUState *env, char *buf); void (*set_notdirty)(ram_addr_t addr); + void (*modify_page)(ram_addr_t addr, int dirty_flags); } QEMUAccel; extern QEMUAccel *current_accel; @@ -639,11 +640,16 @@ static inline void accel_set_notdirty(target_ulong addr) current_accel->set_notdirty(addr); } +static inline void accel_modify_page(target_ulong addr, int dirty_flags) +{ + if (current_accel && current_accel->modify_page) + current_accel->modify_page(addr, dirty_flags); +} + #ifdef USE_KQEMU #define KQEMU_MODIFY_PAGE_MASK (0xff & ~(VGA_DIRTY_FLAG | CODE_DIRTY_FLAG)) int kqemu_cpu_exec(CPUState *env); -void kqemu_modify_page(CPUState *env, ram_addr_t ram_addr); void kqemu_record_dump(void); static inline int kqemu_is_ok(CPUState *env) diff --git a/exec.c b/exec.c index 6d05f75..92f1552 100644 --- a/exec.c +++ b/exec.c @@ -2185,11 +2185,9 @@ static void notdirty_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t #endif } stb_p((uint8_t *)(long)addr, val); -#ifdef USE_KQEMU - if (cpu_single_env->kqemu_enabled && - (dirty_flags & KQEMU_MODIFY_PAGE_MASK) != KQEMU_MODIFY_PAGE_MASK) - kqemu_modify_page(cpu_single_env, ram_addr); -#endif + + accel_modify_page(ram_addr, dirty_flags); + dirty_flags |= (0xff & ~CODE_DIRTY_FLAG); phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags; /* we remove the notdirty callback only if the code has been @@ -2211,11 +2209,9 @@ static void notdirty_mem_writew(void *opaque, target_phys_addr_t addr, uint32_t #endif } stw_p((uint8_t *)(long)addr, val); -#ifdef USE_KQEMU - if (cpu_single_env->kqemu_enabled && - (dirty_flags & KQEMU_MODIFY_PAGE_MASK) != KQEMU_MODIFY_PAGE_MASK) - kqemu_modify_page(cpu_single_env, ram_addr); -#endif + + accel_modify_page(ram_addr, dirty_flags); + dirty_flags |= (0xff & ~CODE_DIRTY_FLAG); phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags; /* we remove the notdirty callback only if the code has been @@ -2237,11 +2233,9 @@ static void notdirty_mem_writel(void *opaque, target_phys_addr_t addr, uint32_t #endif } stl_p((uint8_t *)(long)addr, val); -#ifdef USE_KQEMU - if (cpu_single_env->kqemu_enabled && - (dirty_flags & KQEMU_MODIFY_PAGE_MASK) != KQEMU_MODIFY_PAGE_MASK) - kqemu_modify_page(cpu_single_env, ram_addr); -#endif + + accel_modify_page(ram_addr, dirty_flags); + dirty_flags |= (0xff & ~CODE_DIRTY_FLAG); phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags; /* we remove the notdirty callback only if the code has been diff --git a/kqemu.c b/kqemu.c index 44c1a55..7e24bb7 100644 --- a/kqemu.c +++ b/kqemu.c @@ -358,16 +358,6 @@ void kqemu_set_notdirty(ram_addr_t ram_addr) ram_pages_to_update[nb_ram_pages_to_update++] = ram_addr; } -QEMUAccel kqemu_accel = { - .cpu_interrupt = kqemu_cpu_interrupt, - .init_env = kqemu_init_env, - .flush_cache = kqemu_flush, - .flush_page = kqemu_flush_page, - .info = kqemu_info, - .profile = kqemu_profile, - .set_notdirty = kqemu_set_notdirty, -}; - static void kqemu_reset_modified_ram_pages(void) { int i; @@ -380,7 +370,7 @@ static void kqemu_reset_modified_ram_pages(void) nb_modified_ram_pages = 0; } -void kqemu_modify_page(CPUState *env, ram_addr_t ram_addr) +void kqemu_modify_page(ram_addr_t ram_addr, int dirty_flags) { unsigned long page_index; int ret; @@ -388,6 +378,8 @@ void kqemu_modify_page(CPUState *env, ram_addr_t ram_addr) DWORD temp; #endif + if ((dirty_flags & KQEMU_MODIFY_PAGE_MASK) != KQEMU_MODIFY_PAGE_MASK) + return; page_index = ram_addr >> TARGET_PAGE_BITS; if (!modified_ram_pages_table[page_index]) { #if 0 @@ -411,6 +403,18 @@ void kqemu_modify_page(CPUState *env, ram_addr_t ram_addr) } } +QEMUAccel kqemu_accel = { + .cpu_interrupt = kqemu_cpu_interrupt, + .init_env = kqemu_init_env, + .flush_cache = kqemu_flush, + .flush_page = kqemu_flush_page, + .info = kqemu_info, + .profile = kqemu_profile, + .set_notdirty = kqemu_set_notdirty, + .modify_page = kqemu_modify_page, +}; + + struct fpstate { uint16_t fpuc; uint16_t dummy1; -- 1.5.5