qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 1/2] simplify cpu_x86_register


From: Glauber Costa
Subject: [Qemu-devel] [PATCH 1/2] simplify cpu_x86_register
Date: Tue, 30 Dec 2008 09:52:05 -0500

We don't need to pass the model string by parameter,
since it ough to be part of the CPUState anyway at
the call time. Also, don't declare it as static,
so kvm can call it in the future.

Signed-off-by: Glauber Costa <address@hidden>
---
 target-i386/cpu.h    |    2 ++
 target-i386/helper.c |    5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index ce9b3fe..5235919 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -643,6 +643,8 @@ typedef struct CPUX86State {
 } CPUX86State;
 
 CPUX86State *cpu_x86_init(const char *cpu_model);
+int cpu_x86_register (CPUX86State *env);
+
 int cpu_x86_exec(CPUX86State *s);
 void cpu_x86_close(CPUX86State *s);
 void x86_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt,
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 7d3321a..1389a0a 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -368,9 +368,10 @@ void x86_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, 
const char *fmt, ...))
         (*cpu_fprintf)(f, "x86 %16s\n", x86_defs[i].name);
 }
 
-static int cpu_x86_register (CPUX86State *env, const char *cpu_model)
+int cpu_x86_register (CPUX86State *env)
 {
     x86_def_t def1, *def = &def1;
+    const char *cpu_model = env->cpu_model_str;
 
     if (cpu_x86_find_by_name(def, cpu_model) < 0)
         return -1;
@@ -1626,7 +1627,7 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
             cpu_set_debug_excp_handler(breakpoint_handler);
 #endif
     }
-    if (cpu_x86_register(env, cpu_model) < 0) {
+    if (cpu_x86_register(env) < 0) {
         cpu_x86_close(env);
         return NULL;
     }
-- 
1.5.6.5





reply via email to

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