Am 24.06.2015 um 04:10 schrieb Peter Crosthwaite: > On Thu, Jun 18, 2015 at 10:24 AM, Peter Crosthwaite > <crosthwaitepe...@gmail.com> wrote: >> Remove un-needed usages of ENV_GET_CPU() by converting the APIs to use >> CPUState pointers and retrieving the env_ptr as minimally needed. >> >> Scripted conversion for target-* change: >> >> for I in target-*/cpu.h; do >> sed -i \ >> 's/\(^int cpu_[^_]*_exec(\)[^ ][^ ]* \*s);$/\1CPUState *cpu);/' \ >> $I; >> done >> >> Signed-off-by: Peter Crosthwaite <crosthwaite.pe...@gmail.com> > > Dropping this patch in v4 as no RBs yet.
On a brief look this looks good to me, queued on qom-cpu-next for now. One comment inline. How good do we look after this? I spot 61 uses, with one bad one in target-arm/helper.c. Most of them in linux-user and softmmu headers, one in cputlb.c which we had previously discussed with Paolo to be a non-issue for multi-arch. >> --- >> Changed since v2 (Aurelien review): >> s/CPU_GET_ENV/ENV_GET_CPU/ >> Changed since RFC v2 (RTH review): >> Apply target-* change pattern to all arches. >> Avoid use of cpu_ptr for X86 specifics >> Add () to ENV_GET_CPU macros in commit message >> Add BSD and Linux user needed changes >> Add missing architecture changes >> --- >> bsd-user/main.c | 3 ++- >> cpu-exec.c | 28 +++++++++++++--------------- >> cpus.c | 3 +-- >> linux-user/main.c | 28 ++++++++++++++-------------- >> target-alpha/cpu.h | 2 +- >> target-arm/cpu.h | 2 +- >> target-cris/cpu.h | 2 +- >> target-i386/cpu.h | 2 +- >> target-lm32/cpu.h | 2 +- >> target-m68k/cpu.h | 2 +- >> target-microblaze/cpu.h | 2 +- >> target-mips/cpu.h | 2 +- >> target-moxie/cpu.h | 2 +- >> target-openrisc/cpu.h | 2 +- >> target-ppc/cpu.h | 2 +- >> target-s390x/cpu.h | 2 +- >> target-sh4/cpu.h | 2 +- >> target-sparc/cpu.h | 2 +- >> target-tricore/cpu.h | 2 +- >> target-unicore32/cpu.h | 3 ++- >> target-xtensa/cpu.h | 2 +- >> 21 files changed, 48 insertions(+), 49 deletions(-) >> >> diff --git a/bsd-user/main.c b/bsd-user/main.c >> index 45a1436..7196285 100644 >> --- a/bsd-user/main.c >> +++ b/bsd-user/main.c >> @@ -166,6 +166,7 @@ static void set_idt(int n, unsigned int dpl) >> >> void cpu_loop(CPUX86State *env) >> { >> + CPUState *cs = CPU(x86_env_get_cpu(env)); An (unwritten?) convention has been to avoid double-casts by having an explicit X86CPU *cpu variable. Will re-review the preceding patches for the same nit. Regards, Andreas >> int trapnr; >> abi_ulong pc; >> //target_siginfo_t info; >> @@ -512,7 +513,7 @@ void cpu_loop(CPUSPARCState *env) >> //target_siginfo_t info; >> >> while (1) { >> - trapnr = cpu_sparc_exec (env); >> + trapnr = cpu_sparc_exec(cs); >> >> switch (trapnr) { >> #ifndef TARGET_SPARC64 [snip] -- SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Felix Imendörffer, Jane Smithard, Dilip Upmanyu, Graham Norton; HRB 21284 (AG Nürnberg)