qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [PATCH 04/21] wrap cache flushing functions into accel


From: Anthony Liguori
Subject: [Qemu-devel] Re: [PATCH 04/21] wrap cache flushing functions into accel drivers
Date: Wed, 15 Oct 2008 15:23:42 -0500
User-agent: Thunderbird 2.0.0.17 (X11/20080925)

Glauber Costa wrote:
From: Glauber Costa <address@hidden>

Yet another accel field: cache flushing functions
Signed-off-by: Glauber Costa <address@hidden>
---
 accel.c |    2 ++
 accel.h |   11 +++++++++++
 exec.c  |   15 +++++++--------
 kqemu.c |   15 +++++++++------
 4 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/accel.c b/accel.c
index 3a17dc5..6776244 100644
--- a/accel.c
+++ b/accel.c
@@ -14,5 +14,7 @@ int _accel_nop(void)
 QEMUAccel noaccel = {
     .cpu_interrupt = accel_nop,
     .init_env = accel_nop,
+    .flush_cache = accel_nop,
+    .flush_page = accel_nop,
 };

diff --git a/accel.h b/accel.h
index 0d916dc..935cfef 100644
--- a/accel.h
+++ b/accel.h
@@ -4,6 +4,8 @@
 typedef struct QEMUAccel {
     void (*cpu_interrupt)(CPUState *env);
     void (*init_env)(CPUState *env);
+    void (*flush_cache)(CPUState *env, int global);
+    void (*flush_page)(CPUState *env, target_ulong addr);
 } QEMUAccel;

 extern QEMUAccel *current_accel;
@@ -24,4 +26,13 @@ static inline void accel_init_env(CPUState *env)
     current_accel->init_env(env);
 }

+static inline void accel_flush_cache(CPUState *env, int global)
+{
+    current_accel->flush_cache(env, global);
+}
+
+static inline void accel_flush_page(CPUState *env, target_ulong addr)
+{
+    current_accel->flush_page(env, addr);
+}
 #endif
diff --git a/exec.c b/exec.c
index 21253cc..c761f4a 100644
--- a/exec.c
+++ b/exec.c
@@ -1684,10 +1684,10 @@ void tlb_flush(CPUState *env, int flush_global)

     memset (env->tb_jmp_cache, 0, TB_JMP_CACHE_SIZE * sizeof (void *));

-#ifdef USE_KQEMU
-    if (env->kqemu_enabled) {
-        kqemu_flush(env, flush_global);
-    }
+    accel_flush_cache(env, flush_global);
+
+#if !defined(CONFIG_SOFTMMU)
+    munmap((void *)MMAP_AREA_START, MMAP_AREA_END - MMAP_AREA_START);

Where did this come from?? I understand the rather simple conversion of kqemu_flush to accel_flush_cache but it's not at all clear where this munmap came from.

 #endif
     tlb_flush_count++;
 }
@@ -1730,10 +1730,9 @@ void tlb_flush_page(CPUState *env, target_ulong addr)

     tlb_flush_jmp_cache(env, addr);

-#ifdef USE_KQEMU
-    if (env->kqemu_enabled) {
-        kqemu_flush_page(env, addr);
-    }
+    accel_flush_page(env, addr);
+#if !defined(CONFIG_SOFTMMU)
+    if (addr < MMAP_AREA_END)

And what is this if() being added for?


Regards,

Anthony Liguori




reply via email to

[Prev in Thread] Current Thread [Next in Thread]