[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 18/47] target-cris: Move TCG initialization to CRISC
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH 18/47] target-cris: Move TCG initialization to CRISCPU initfn |
Date: |
Sat, 16 Feb 2013 16:45:13 +0100 |
Split out TCG initialization from cpu_cris_init(). Avoid CPUCRISState
dependency for v10-specific initialization and for non-v10 by inlining
the decision into the initfn as well.
Signed-off-by: Andreas Färber <address@hidden>
---
target-cris/cpu.c | 10 ++++++++++
target-cris/cpu.h | 3 +++
target-cris/translate.c | 19 +++++--------------
target-cris/translate_v10.c | 5 +----
4 Dateien geändert, 19 Zeilen hinzugefügt(+), 18 Zeilen entfernt(-)
diff --git a/target-cris/cpu.c b/target-cris/cpu.c
index 34c4f75..fedf641 100644
--- a/target-cris/cpu.c
+++ b/target-cris/cpu.c
@@ -70,8 +70,18 @@ static void cris_cpu_initfn(Object *obj)
{
CRISCPU *cpu = CRIS_CPU(obj);
CPUCRISState *env = &cpu->env;
+ static bool tcg_initialized;
cpu_exec_init(env);
+
+ if (tcg_enabled() && !tcg_initialized) {
+ tcg_initialized = true;
+ if (env->pregs[PR_VR] < 32) {
+ cris_initialize_crisv10_tcg();
+ } else {
+ cris_initialize_tcg();
+ }
+ }
}
static void cris_cpu_class_init(ObjectClass *oc, void *data)
diff --git a/target-cris/cpu.h b/target-cris/cpu.h
index 257cb52..ebf2d40 100644
--- a/target-cris/cpu.h
+++ b/target-cris/cpu.h
@@ -182,6 +182,9 @@ void do_interrupt(CPUCRISState *env);
int cpu_cris_signal_handler(int host_signum, void *pinfo,
void *puc);
+void cris_initialize_tcg(void);
+void cris_initialize_crisv10_tcg(void);
+
enum {
CC_OP_DYNAMIC, /* Use env->cc_op */
CC_OP_FLAGS,
diff --git a/target-cris/translate.c b/target-cris/translate.c
index 25ff490..25a43fa 100644
--- a/target-cris/translate.c
+++ b/target-cris/translate.c
@@ -3550,8 +3550,6 @@ CRISCPU *cpu_cris_init(const char *cpu_model)
{
CRISCPU *cpu;
CPUCRISState *env;
- static int tcg_initialized = 0;
- int i;
cpu = CRIS_CPU(object_new(TYPE_CRIS_CPU));
env = &cpu->env;
@@ -3560,21 +3558,16 @@ CRISCPU *cpu_cris_init(const char *cpu_model)
object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
- if (tcg_initialized) {
- return cpu;
- }
+ return cpu;
+}
- tcg_initialized = 1;
+void cris_initialize_tcg(void)
+{
+ int i;
#define GEN_HELPER 2
#include "helper.h"
- if (env->pregs[PR_VR] < 32) {
- cpu_crisv10_init(env);
- return cpu;
- }
-
-
cpu_env = tcg_global_reg_new_ptr(TCG_AREG0, "env");
cc_x = tcg_global_mem_new(TCG_AREG0,
offsetof(CPUCRISState, cc_x), "cc_x");
@@ -3614,8 +3607,6 @@ CRISCPU *cpu_cris_init(const char *cpu_model)
offsetof(CPUCRISState, pregs[i]),
pregnames[i]);
}
-
- return cpu;
}
void restore_state_to_opc(CPUCRISState *env, TranslationBlock *tb, int pc_pos)
diff --git a/target-cris/translate_v10.c b/target-cris/translate_v10.c
index d2cca89..d6ef084 100644
--- a/target-cris/translate_v10.c
+++ b/target-cris/translate_v10.c
@@ -1257,7 +1257,7 @@ static unsigned int crisv10_decoder(CPUCRISState *env,
DisasContext *dc)
return insn_len;
}
-static CPUCRISState *cpu_crisv10_init (CPUCRISState *env)
+void cris_initialize_crisv10_tcg(void)
{
int i;
@@ -1300,7 +1300,4 @@ static CPUCRISState *cpu_crisv10_init (CPUCRISState *env)
offsetof(CPUCRISState, pregs[i]),
pregnames_v10[i]);
}
-
- return env;
}
-
--
1.7.10.4
- [Qemu-devel] [PATCH 10/47] target-microblaze: Introduce QOM realizefn for MicroBlazeCPU, (continued)
- [Qemu-devel] [PATCH 10/47] target-microblaze: Introduce QOM realizefn for MicroBlazeCPU, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 08/47] target-lm32: Introduce QOM realizefn for LM32CPU, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 06/47] target-ppc: Update PowerPCCPU to QOM realizefn, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 07/47] target-cris: Introduce QOM realizefn for CRISCPU, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 09/47] target-m68k: Introduce QOM realizefn for M68kCPU, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 12/47] target-s390x: Introduce QOM realizefn for S390CPU, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 15/47] target-unicore32: Introduce QOM realizefn for UniCore32CPU, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 11/47] target-mips: Introduce QOM realizefn for MIPSCPU, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 13/47] target-sh4: Introduce QOM realizefn for SuperHCPU, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 19/47] target-lm32: Move TCG initialization to LM32CPU initfn, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 18/47] target-cris: Move TCG initialization to CRISCPU initfn,
Andreas Färber <=
- [Qemu-devel] [PATCH 17/47] target-arm: Move TCG initialization to ARMCPU initfn, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 14/47] target-sparc: Introduce QOM realizefn for SPARCCPU, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 20/47] target-m68k: Move TCG initialization to M68kCPU initfn, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 21/47] target-microblaze: Move TCG initialization to MicroBlazeCPU initfn, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 16/47] target-xtensa: Introduce QOM realizefn for XtensaCPU, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 24/47] target-s390x: Move TCG initialization to S390CPU initfn, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 22/47] target-mips: Move TCG initialization to MIPSCPU initfn, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 25/47] target-sh4: Move TCG initialization to SuperHCPU initfn, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 23/47] target-ppc: Move TCG initialization to PowerPCCPU initfn, Andreas Färber, 2013/02/16
- [Qemu-devel] [PATCH 26/47] target-sparc: Move TCG initialization to SPARCCPU initfn, Andreas Färber, 2013/02/16