[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 04/13] target-sh4: Do not reset CPU feature flags
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH v3 04/13] target-sh4: Do not reset CPU feature flags on reset |
Date: |
Sun, 15 Apr 2012 00:12:36 +0200 |
Move them out of CPUSH4State so that they are not zero'ed on reset.
Signed-off-by: Andreas Färber <address@hidden>
---
hw/sh7750.c | 5 +++--
target-sh4/cpu-qom.h | 3 +++
target-sh4/cpu.h | 3 ---
target-sh4/translate.c | 5 +++--
4 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/hw/sh7750.c b/hw/sh7750.c
index e712928..c7e653c 100644
--- a/hw/sh7750.c
+++ b/hw/sh7750.c
@@ -77,10 +77,11 @@ typedef struct SH7750State {
struct intc_desc intc;
} SH7750State;
-static inline int has_bcr3_and_bcr4(SH7750State * s)
+static inline int has_bcr3_and_bcr4(SH7750State *s)
{
- return (s->cpu->features & SH_FEATURE_BCR3_AND_BCR4);
+ return sh_env_get_cpu(s->cpu)->features & SH_FEATURE_BCR3_AND_BCR4;
}
+
/**********************************************************************
I/O ports
**********************************************************************/
diff --git a/target-sh4/cpu-qom.h b/target-sh4/cpu-qom.h
index c41164a..7f231f1 100644
--- a/target-sh4/cpu-qom.h
+++ b/target-sh4/cpu-qom.h
@@ -48,6 +48,7 @@ typedef struct SuperHCPUClass {
/**
* SuperHCPU:
* @env: #CPUSH4State
+ * @features: CPU feature flags, see #sh_features.
*
* A SuperH CPU.
*/
@@ -57,6 +58,8 @@ typedef struct SuperHCPU {
/*< public >*/
CPUSH4State env;
+
+ uint32_t features;
} SuperHCPU;
static inline SuperHCPU *sh_env_get_cpu(CPUSH4State *env)
diff --git a/target-sh4/cpu.h b/target-sh4/cpu.h
index b6768f1..6a518f2 100644
--- a/target-sh4/cpu.h
+++ b/target-sh4/cpu.h
@@ -157,9 +157,6 @@ typedef struct CPUSH4State {
/* float point status register */
float_status fp_status;
- /* The features that we should emulate. See sh_features above. */
- uint32_t features;
-
/* Those belong to the specific unit (SH7750) but are handled here */
uint32_t mmucr; /* MMU control register */
uint32_t pteh; /* page table entry high register */
diff --git a/target-sh4/translate.c b/target-sh4/translate.c
index b7426f1..176c7d4 100644
--- a/target-sh4/translate.c
+++ b/target-sh4/translate.c
@@ -258,7 +258,7 @@ CPUSH4State *cpu_sh4_init(const char *cpu_model)
return NULL;
cpu = SUPERH_CPU(object_new(TYPE_SUPERH_CPU));
env = &cpu->env;
- env->features = def->features;
+ cpu->features = def->features;
sh4_translate_init();
env->cpu_model_str = cpu_model;
cpu_register(env, def);
@@ -1902,6 +1902,7 @@ static inline void
gen_intermediate_code_internal(CPUSH4State * env, TranslationBlock * tb,
int search_pc)
{
+ SuperHCPU *cpu = sh_env_get_cpu(env);
DisasContext ctx;
target_ulong pc_start;
static uint16_t *gen_opc_end;
@@ -1923,7 +1924,7 @@ gen_intermediate_code_internal(CPUSH4State * env,
TranslationBlock * tb,
ctx.delayed_pc = -1; /* use delayed pc from env pointer */
ctx.tb = tb;
ctx.singlestep_enabled = env->singlestep_enabled;
- ctx.features = env->features;
+ ctx.features = cpu->features;
ctx.has_movcal = (tb->flags & TB_FLAG_PENDING_MOVCA);
ii = -1;
--
1.7.7
- [Qemu-devel] [PATCH v3 00/13] QOM'ify SuperH CPU, Andreas Färber, 2012/04/14
- [Qemu-devel] [PATCH v3 04/13] target-sh4: Do not reset CPU feature flags on reset,
Andreas Färber <=
- [Qemu-devel] [PATCH v3 03/13] target-sh4: Start QOM'ifying CPU init, Andreas Färber, 2012/04/14
- [Qemu-devel] [PATCH v3 01/13] target-sh4: QOM'ify CPU, Andreas Färber, 2012/04/14
- [Qemu-devel] [PATCH v3 02/13] target-sh4: QOM'ify CPU reset, Andreas Färber, 2012/04/14
- [Qemu-devel] [PATCH v3 05/13] hw/sh7750: Use SuperHCPU, Andreas Färber, 2012/04/14
- [Qemu-devel] [PATCH v3 08/13] target-sh4: Make find_*tlb_entry() take SuperHCPU, Andreas Färber, 2012/04/14