qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 4/7] target-alpha: Let cpu_alpha_init() return Alpha


From: Andreas Färber
Subject: [Qemu-devel] [PATCH 4/7] target-alpha: Let cpu_alpha_init() return AlphaCPU
Date: Wed, 31 Oct 2012 04:04:01 +0100

Replace cpu_init() macro with inline function for backwards
compatibility.

Signed-off-by: Andreas Färber <address@hidden>
---
 target-alpha/cpu.h       |   13 +++++++++++--
 target-alpha/translate.c |    4 ++--
 2 Dateien geändert, 13 Zeilen hinzugefügt(+), 4 Zeilen entfernt(-)

diff --git a/target-alpha/cpu.h b/target-alpha/cpu.h
index 28999ab..2bbde9c 100644
--- a/target-alpha/cpu.h
+++ b/target-alpha/cpu.h
@@ -297,7 +297,6 @@ struct CPUAlphaState {
     int implver;
 };
 
-#define cpu_init cpu_alpha_init
 #define cpu_list alpha_cpu_list
 #define cpu_exec cpu_alpha_exec
 #define cpu_gen_code cpu_alpha_gen_code
@@ -435,7 +434,17 @@ enum {
     IR_ZERO = 31,
 };
 
-CPUAlphaState *cpu_alpha_init(const char *cpu_model);
+AlphaCPU *cpu_alpha_init(const char *cpu_model);
+
+static inline CPUAlphaState *cpu_init(const char *cpu_model)
+{
+    AlphaCPU *cpu = cpu_alpha_init(cpu_model);
+    if (cpu == NULL) {
+        return NULL;
+    }
+    return &cpu->env;
+}
+
 void alpha_cpu_list(FILE *f, fprintf_function cpu_fprintf);
 int cpu_alpha_exec(CPUAlphaState *s);
 /* you can call this signal handler from your SIGBUS and SIGSEGV
diff --git a/target-alpha/translate.c b/target-alpha/translate.c
index 6ee031d..5419df1 100644
--- a/target-alpha/translate.c
+++ b/target-alpha/translate.c
@@ -3493,7 +3493,7 @@ void gen_intermediate_code_pc (CPUAlphaState *env, struct 
TranslationBlock *tb)
     gen_intermediate_code_internal(env, tb, 1);
 }
 
-CPUAlphaState *cpu_alpha_init(const char *cpu_model)
+AlphaCPU *cpu_alpha_init(const char *cpu_model)
 {
     AlphaCPU *cpu;
     CPUAlphaState *env;
@@ -3511,7 +3511,7 @@ CPUAlphaState *cpu_alpha_init(const char *cpu_model)
     env->cpu_model_str = cpu_model;
 
     qemu_init_vcpu(env);
-    return env;
+    return cpu;
 }
 
 void restore_state_to_opc(CPUAlphaState *env, TranslationBlock *tb, int pc_pos)
-- 
1.7.10.4




reply via email to

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