Message ID | 1410626734-3804-6-git-send-email-rth@twiddle.net |
---|---|
State | New |
Headers | show |
Richard Henderson writes: > Cc: qemu-ppc@nongnu.org > Signed-off-by: Richard Henderson <rth@twiddle.net> <snip> > +static void ppc_cpu_exec_enter(CPUState *cs) > +{ > + PowerPCCPU *cpu = POWERPC_CPU(cs); > + CPUPPCState *env = &cpu->env; > + Ok the naming of those structures and the order to traverse them gets confusing - is it really CPUState -> ${ARCH}CPU -> ${ARCH}CPUState? Anyway... Reviewed-by: Alex Bennée <alex.bennee@linaro.org> > + env->reserve_addr = -1; > +} > + > /* CPUClass::reset() */ > static void ppc_cpu_reset(CPUState *s) > { > @@ -9638,6 +9646,7 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data) > cc->write_elf64_qemunote = ppc64_cpu_write_elf64_qemunote; > #endif > #endif > + cc->cpu_exec_enter = ppc_cpu_exec_enter; > > cc->gdb_num_core_regs = 71;
On 14 September 2014 12:43, Alex Bennée <alex.bennee@linaro.org> wrote: > > Richard Henderson writes: > >> Cc: qemu-ppc@nongnu.org >> Signed-off-by: Richard Henderson <rth@twiddle.net> > <snip> >> +static void ppc_cpu_exec_enter(CPUState *cs) >> +{ >> + PowerPCCPU *cpu = POWERPC_CPU(cs); >> + CPUPPCState *env = &cpu->env; >> + > > Ok the naming of those structures and the order to traverse them gets > confusing - is it really CPUState -> ${ARCH}CPU -> ${ARCH}CPUState? CPUState is the QOM base class name. The subclass names are ${ARCH}CPU. CPU${ARCH}State is the name of the "env struct" which is embedded within the ${ARCH}CPU struct (but not at the start of it). The available conversions are: ${ARCH}CPU to CPUState : CPU(x) CPUState to ${ARCH}CPU : ${ARCH}_CPU(cs) (these are just the stock QOM casting macros) ${ARCH}CPU to env: &cpu->env env to ${ARCH}CPU: ${arch}_env_get_cpu(env) (the latter is just a container_of operation) env to CPUState: ENV_GET_CPU(env) CPUState to env: convert via ${ARCH}_CPU (and actually ENV_GET_CPU is just sugar for a conversion via ${ARCH}_CPU) As a method on the base QOM CPU class, this family of functions is correctly taking CPUState* as the argument. -- PMM
diff --git a/cpu-exec.c b/cpu-exec.c index 9f84dda..d930e7a 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -352,9 +352,6 @@ int cpu_exec(CPUArchState *env) cpu->exit_request = 1; } -#if defined(TARGET_PPC) - env->reserve_addr = -1; -#endif cc->cpu_exec_enter(cpu); cpu->exception_index = -1; diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c index 48177ed..e577e03 100644 --- a/target-ppc/translate_init.c +++ b/target-ppc/translate_init.c @@ -9456,6 +9456,14 @@ static bool ppc_cpu_has_work(CPUState *cs) return msr_ee && (cs->interrupt_request & CPU_INTERRUPT_HARD); } +static void ppc_cpu_exec_enter(CPUState *cs) +{ + PowerPCCPU *cpu = POWERPC_CPU(cs); + CPUPPCState *env = &cpu->env; + + env->reserve_addr = -1; +} + /* CPUClass::reset() */ static void ppc_cpu_reset(CPUState *s) { @@ -9638,6 +9646,7 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data) cc->write_elf64_qemunote = ppc64_cpu_write_elf64_qemunote; #endif #endif + cc->cpu_exec_enter = ppc_cpu_exec_enter; cc->gdb_num_core_regs = 71;
Cc: qemu-ppc@nongnu.org Signed-off-by: Richard Henderson <rth@twiddle.net> --- cpu-exec.c | 3 --- target-ppc/translate_init.c | 9 +++++++++ 2 files changed, 9 insertions(+), 3 deletions(-)