Allow the current accelerator to provide it's own, customized
address of the CPUState structure used for the env variable.

Signed-off-by: Glauber Costa <[EMAIL PROTECTED]>
---
 accel.h              |    8 ++++++++
 target-i386/helper.c |    2 +-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/accel.h b/accel.h
index 52b95e4..08ad337 100644
--- a/accel.h
+++ b/accel.h
@@ -1,6 +1,7 @@
 typedef struct QEMUAccel {
     char *name;
     void (*cpu_interrupt)(CPUState *env);
+    CPUState *(*get_env)(void);
     void (*init_env)(CPUState *env);
     int (*start)(void);
     void (*flush_cache)(CPUState *env, int global);
@@ -76,6 +77,13 @@ static inline void accel_start(void)
     }
 }
 
+static inline CPUState *accel_get_env(void)
+{
+    if (current_accel && current_accel->get_env)
+        return current_accel->get_env();
+    return qemu_mallocz(sizeof(CPUState));
+}
+
 static inline void accel_init_env(CPUState *env)
 {
     if (current_accel && current_accel->init_env)
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 4febc45..9bb726f 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -98,7 +98,7 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
     CPUX86State *env;
     static int inited;
 
-    env = qemu_mallocz(sizeof(CPUX86State));
+    env = accel_get_env();
     if (!env)
         return NULL;
     cpu_exec_init(env);
-- 
1.5.5.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to