Skip to content

Commit

Permalink
target-sh4: Do not reset CPU feature flags on reset
Browse files Browse the repository at this point in the history
Move them out of CPUSH4State so that they are not zero'ed on reset.

Signed-off-by: Andreas Färber <afaerber@suse.de>
  • Loading branch information
afaerber committed Apr 16, 2012
1 parent 53dc22c commit 72b5ccf
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions hw/sh7750.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
**********************************************************************/
Expand Down
3 changes: 3 additions & 0 deletions target-sh4/cpu-qom.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ typedef struct SuperHCPUClass {
/**
* SuperHCPU:
* @env: #CPUSH4State
* @features: CPU feature flags, see #sh_features.
*
* A SuperH CPU.
*/
Expand All @@ -57,6 +58,8 @@ typedef struct SuperHCPU {
/*< public >*/

CPUSH4State env;

uint32_t features;
} SuperHCPU;

static inline SuperHCPU *sh_env_get_cpu(CPUSH4State *env)
Expand Down
3 changes: 0 additions & 3 deletions target-sh4/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
5 changes: 3 additions & 2 deletions target-sh4/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 72b5ccf

Please sign in to comment.