[PATCH 04/13] [PATCH] init env made accel driver

Glauber Costa
2008-05-15T14:09:24Z

---
exec-all.h | 8 +++++++-
kqemu.c | 1 +
target-i386/helper2.c | 4 +---
3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/exec-all.h b/exec-all.h
index 7b2d97d..9e211dc 100644
--- a/exec-all.h
+++ b/exec-all.h
@@ -580,6 +580,7 @@ static inline target_ulong get_phys_addr_code(CPUState *env1, target_ulong addr)

typedef struct QEMUAccel {
void (*cpu_interrupt)(CPUState *env);
+ void (*init_env)(CPUState *env);
} QEMUAccel;

extern QEMUAccel *current_accel;
@@ -595,10 +596,15 @@ static inline void accel_cpu_interrupt(CPUState *env)
current_accel->cpu_interrupt(env);
}

+static inline void accel_init_env(CPUState *env)
+{
+ if (current_accel && current_accel->init_env)
+ current_accel->init_env(env);
+}
+
#ifdef USE_KQEMU
#define KQEMU_MODIFY_PAGE_MASK (0xff & ~(VGA_DIRTY_FLAG | CODE_DIRTY_FLAG))

-int kqemu_init(CPUState *env);
int kqemu_cpu_exec(CPUState *env);
void kqemu_flush_page(CPUState *env, target_ulong addr);
void kqemu_flush(CPUState *env, int global);
diff --git a/kqemu.c b/kqemu.c
index f875e0e..e0422de 100644
--- a/kqemu.c
+++ b/kqemu.c
@@ -263,6 +263,7 @@ void kqemu_cpu_interrupt(CPUState *env)

QEMUAccel kqemu_accel = {
.cpu_interrupt = kqemu_cpu_interrupt,
+ .init_env = kqemu_init_env,
};

diff --git a/target-i386/helper2.c b/target-i386/helper2.c
index 1c0fcdb..b633814 100644
--- a/target-i386/helper2.c
+++ b/target-i386/helper2.c
@@ -112,9 +112,7 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
return NULL;
}
cpu_reset(env);
-#ifdef USE_KQEMU
- kqemu_init_env(env);
-#endif
+ accel_init_env(env);
return env;