This simplifies the code after conversion to DisasContext::cpu. Signed-off-by: Andreas Färber <afaer...@suse.de> --- target-lm32/cpu-qom.h | 3 +++ target-lm32/cpu.h | 2 -- target-lm32/helper.c | 2 +- target-lm32/translate.c | 16 ++++++++-------- 4 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/target-lm32/cpu-qom.h b/target-lm32/cpu-qom.h index 723f604..16ef037 100644 --- a/target-lm32/cpu-qom.h +++ b/target-lm32/cpu-qom.h @@ -51,6 +51,7 @@ typedef struct LM32CPUClass { /** * LM32CPU: * @env: #CPULM32State + * @features: Processor core features. * * A LatticeMico32 CPU. */ @@ -60,6 +61,8 @@ typedef struct LM32CPU { /*< public >*/ CPULM32State env; + + uint32_t features; } LM32CPU; static inline LM32CPU *lm32_env_get_cpu(CPULM32State *env) diff --git a/target-lm32/cpu.h b/target-lm32/cpu.h index 85c89e8..0ff8e7c 100644 --- a/target-lm32/cpu.h +++ b/target-lm32/cpu.h @@ -173,8 +173,6 @@ struct CPULM32State { /* JTAG UART handle for callbacks */ DeviceState *juart_state; - /* processor core features */ - uint32_t features; uint32_t flags; uint8_t num_bps; uint8_t num_wps; diff --git a/target-lm32/helper.c b/target-lm32/helper.c index 8f2b9fd..68de4ee 100644 --- a/target-lm32/helper.c +++ b/target-lm32/helper.c @@ -218,7 +218,7 @@ LM32CPU *cpu_lm32_init(const char *cpu_model) cpu = LM32_CPU(object_new(TYPE_LM32_CPU)); env = &cpu->env; - env->features = def->features; + cpu->features = def->features; env->num_bps = def->num_breakpoints; env->num_wps = def->num_watchpoints; env->cfg = cfg_by_def(def); diff --git a/target-lm32/translate.c b/target-lm32/translate.c index 57b91c4..d4e8106 100644 --- a/target-lm32/translate.c +++ b/target-lm32/translate.c @@ -421,7 +421,7 @@ static void dec_divu(DisasContext *dc) LOG_DIS("divu r%d, r%d, r%d\n", dc->r2, dc->r0, dc->r1); - if (!(dc->cpu->env.features & LM32_FEATURE_DIVIDE)) { + if (!(dc->cpu->features & LM32_FEATURE_DIVIDE)) { cpu_abort(CPU(dc->cpu), "hardware divider is not available\n"); } @@ -499,7 +499,7 @@ static void dec_modu(DisasContext *dc) LOG_DIS("modu r%d, r%d, %d\n", dc->r2, dc->r0, dc->r1); - if (!(dc->cpu->env.features & LM32_FEATURE_DIVIDE)) { + if (!(dc->cpu->features & LM32_FEATURE_DIVIDE)) { cpu_abort(CPU(dc->cpu), "hardware divider is not available\n"); } @@ -520,7 +520,7 @@ static void dec_mul(DisasContext *dc) LOG_DIS("mul r%d, r%d, r%d\n", dc->r2, dc->r0, dc->r1); } - if (!(dc->cpu->env.features & LM32_FEATURE_MULTIPLY)) { + if (!(dc->cpu->features & LM32_FEATURE_MULTIPLY)) { cpu_abort(CPU(dc->cpu), "hardware multiplier is not available\n"); } @@ -671,7 +671,7 @@ static void dec_sextb(DisasContext *dc) { LOG_DIS("sextb r%d, r%d\n", dc->r2, dc->r0); - if (!(dc->cpu->env.features & LM32_FEATURE_SIGN_EXTEND)) { + if (!(dc->cpu->features & LM32_FEATURE_SIGN_EXTEND)) { cpu_abort(CPU(dc->cpu), "hardware sign extender is not available\n"); } @@ -682,7 +682,7 @@ static void dec_sexth(DisasContext *dc) { LOG_DIS("sexth r%d, r%d\n", dc->r2, dc->r0); - if (!(dc->cpu->env.features & LM32_FEATURE_SIGN_EXTEND)) { + if (!(dc->cpu->features & LM32_FEATURE_SIGN_EXTEND)) { cpu_abort(CPU(dc->cpu), "hardware sign extender is not available\n"); } @@ -709,7 +709,7 @@ static void dec_sl(DisasContext *dc) LOG_DIS("sl r%d, r%d, r%d\n", dc->r2, dc->r0, dc->r1); } - if (!(dc->cpu->env.features & LM32_FEATURE_SHIFT)) { + if (!(dc->cpu->features & LM32_FEATURE_SHIFT)) { cpu_abort(CPU(dc->cpu), "hardware shifter is not available\n"); } @@ -731,7 +731,7 @@ static void dec_sr(DisasContext *dc) LOG_DIS("sr r%d, r%d, r%d\n", dc->r2, dc->r0, dc->r1); } - if (!(dc->cpu->env.features & LM32_FEATURE_SHIFT)) { + if (!(dc->cpu->features & LM32_FEATURE_SHIFT)) { if (dc->format == OP_FMT_RI) { /* TODO: check r1 == 1 during runtime */ } else { @@ -759,7 +759,7 @@ static void dec_sru(DisasContext *dc) LOG_DIS("sru r%d, r%d, r%d\n", dc->r2, dc->r0, dc->r1); } - if (!(dc->cpu->env.features & LM32_FEATURE_SHIFT)) { + if (!(dc->cpu->features & LM32_FEATURE_SHIFT)) { if (dc->format == OP_FMT_RI) { /* TODO: check r1 == 1 during runtime */ } else { -- 1.8.1.4