Received: from eggs.gnu.org ([208.118.235.92]:43158) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwksP-00086p-E9 for qemu-devel@nongnu.org; Sat, 19 Jan 2013 21:43:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TwksM-00015J-TZ for qemu-devel@nongnu.org; Sat, 19 Jan 2013 21:43:17 -0500 Received: from cantor2.suse.de ([195.135.220.15]:40440 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwksM-00014B-DA for qemu-devel@nongnu.org; Sat, 19 Jan 2013 21:43:14 -0500 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sun, 20 Jan 2013 03:43:02 +0100 Message-Id: <1358649782-18495-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH qom-cpu for-1.4] target-openrisc: Clean up triple QOM casts List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: proljc@gmail.com, =?UTF-8?q?Andreas=20F=C3=A4rber?= Instead of calling openrisc_env_get_cpu(), casting to CPU() via the ENV_GET_CPU() compatibility macro and casting back to OPENRISC_CPU(), just call openrisc_env_get_cpu() directly. ENV_GET_CPU() is meant as workaround for target-independent code only. Signed-off-by: Andreas F=C3=A4rber --- target-openrisc/exception_helper.c | 2 +- target-openrisc/fpu_helper.c | 32 ++++++++++++++++--------------= -- target-openrisc/int_helper.c | 2 +- target-openrisc/interrupt_helper.c | 2 +- target-openrisc/mmu.c | 6 +++--- target-openrisc/sys_helper.c | 4 ++-- 6 Dateien ge=C3=A4ndert, 24 Zeilen hinzugef=C3=BCgt(+), 24 Zeilen entfer= nt(-) diff --git a/target-openrisc/exception_helper.c b/target-openrisc/excepti= on_helper.c index dab4148..0c53b77 100644 --- a/target-openrisc/exception_helper.c +++ b/target-openrisc/exception_helper.c @@ -23,7 +23,7 @@ =20 void HELPER(exception)(CPUOpenRISCState *env, uint32_t excp) { - OpenRISCCPU *cpu =3D OPENRISC_CPU(ENV_GET_CPU(env)); + OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); =20 raise_exception(cpu, excp); } diff --git a/target-openrisc/fpu_helper.c b/target-openrisc/fpu_helper.c index b184d5e..4615a36 100644 --- a/target-openrisc/fpu_helper.c +++ b/target-openrisc/fpu_helper.c @@ -68,7 +68,7 @@ static inline void update_fpcsr(OpenRISCCPU *cpu) uint64_t HELPER(itofd)(CPUOpenRISCState *env, uint64_t val) { uint64_t itofd; - OpenRISCCPU *cpu =3D OPENRISC_CPU(ENV_GET_CPU(env)); + OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); =20 set_float_exception_flags(0, &cpu->env.fp_status); itofd =3D int32_to_float64(val, &cpu->env.fp_status); @@ -80,7 +80,7 @@ uint64_t HELPER(itofd)(CPUOpenRISCState *env, uint64_t = val) uint32_t HELPER(itofs)(CPUOpenRISCState *env, uint32_t val) { uint32_t itofs; - OpenRISCCPU *cpu =3D OPENRISC_CPU(ENV_GET_CPU(env)); + OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); =20 set_float_exception_flags(0, &cpu->env.fp_status); itofs =3D int32_to_float32(val, &cpu->env.fp_status); @@ -92,7 +92,7 @@ uint32_t HELPER(itofs)(CPUOpenRISCState *env, uint32_t = val) uint64_t HELPER(ftoid)(CPUOpenRISCState *env, uint64_t val) { uint64_t ftoid; - OpenRISCCPU *cpu =3D OPENRISC_CPU(ENV_GET_CPU(env)); + OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); =20 set_float_exception_flags(0, &cpu->env.fp_status); ftoid =3D float32_to_int64(val, &cpu->env.fp_status); @@ -104,7 +104,7 @@ uint64_t HELPER(ftoid)(CPUOpenRISCState *env, uint64_= t val) uint32_t HELPER(ftois)(CPUOpenRISCState *env, uint32_t val) { uint32_t ftois; - OpenRISCCPU *cpu =3D OPENRISC_CPU(ENV_GET_CPU(env)); + OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); =20 set_float_exception_flags(0, &cpu->env.fp_status); ftois =3D float32_to_int32(val, &cpu->env.fp_status); @@ -120,7 +120,7 @@ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState= *env, \ uint64_t fdt0, uint64_t fdt1) = \ { = \ uint64_t result; = \ - OpenRISCCPU *cpu =3D OPENRISC_CPU(ENV_GET_CPU(env)); = \ + OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); = \ set_float_exception_flags(0, &cpu->env.fp_status); = \ result =3D float64_ ## name(fdt0, fdt1, &cpu->env.fp_status); = \ update_fpcsr(cpu); = \ @@ -131,7 +131,7 @@ uint32_t helper_float_ ## name ## _s(CPUOpenRISCState= *env, \ uint32_t fdt0, uint32_t fdt1) = \ { = \ uint32_t result; = \ - OpenRISCCPU *cpu =3D OPENRISC_CPU(ENV_GET_CPU(env)); = \ + OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); = \ set_float_exception_flags(0, &cpu->env.fp_status); = \ result =3D float32_ ## name(fdt0, fdt1, &cpu->env.fp_status); = \ update_fpcsr(cpu); = \ @@ -152,7 +152,7 @@ uint64_t helper_float_ ## name1 ## name2 ## _d(CPUOpe= nRISCState *env, \ { = \ uint64_t result, temp, hi, lo; = \ uint32_t val1, val2; = \ - OpenRISCCPU *cpu =3D OPENRISC_CPU(ENV_GET_CPU(env)); = \ + OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); = \ hi =3D env->fpmaddhi; = \ lo =3D env->fpmaddlo; = \ set_float_exception_flags(0, &cpu->env.fp_status); = \ @@ -174,7 +174,7 @@ uint32_t helper_float_ ## name1 ## name2 ## _s(CPUOpe= nRISCState *env, \ { = \ uint64_t result, temp, hi, lo; = \ uint32_t val1, val2; = \ - OpenRISCCPU *cpu =3D OPENRISC_CPU(ENV_GET_CPU(env)); = \ + OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); = \ hi =3D cpu->env.fpmaddhi; = \ lo =3D cpu->env.fpmaddlo; = \ set_float_exception_flags(0, &cpu->env.fp_status); = \ @@ -198,7 +198,7 @@ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState= *env, \ uint64_t fdt0, uint64_t fdt1) = \ { = \ int res; = \ - OpenRISCCPU *cpu =3D OPENRISC_CPU(ENV_GET_CPU(env)); = \ + OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); = \ set_float_exception_flags(0, &cpu->env.fp_status); = \ res =3D float64_ ## name(fdt0, fdt1, &cpu->env.fp_status); = \ update_fpcsr(cpu); = \ @@ -209,7 +209,7 @@ uint32_t helper_float_ ## name ## _s(CPUOpenRISCState= *env, \ uint32_t fdt0, uint32_t fdt= 1)\ { = \ int res; = \ - OpenRISCCPU *cpu =3D OPENRISC_CPU(ENV_GET_CPU(env)); = \ + OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); = \ set_float_exception_flags(0, &cpu->env.fp_status); = \ res =3D float32_ ## name(fdt0, fdt1, &cpu->env.fp_status); = \ update_fpcsr(cpu); = \ @@ -227,7 +227,7 @@ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState= *env, \ uint64_t fdt0, uint64_t fdt1) = \ { = \ int res; = \ - OpenRISCCPU *cpu =3D OPENRISC_CPU(ENV_GET_CPU(env)); = \ + OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); = \ set_float_exception_flags(0, &cpu->env.fp_status); = \ res =3D !float64_eq_quiet(fdt0, fdt1, &cpu->env.fp_status); = \ update_fpcsr(cpu); = \ @@ -238,7 +238,7 @@ uint32_t helper_float_ ## name ## _s(CPUOpenRISCState= *env, \ uint32_t fdt0, uint32_t fdt1) = \ { = \ int res; = \ - OpenRISCCPU *cpu =3D OPENRISC_CPU(ENV_GET_CPU(env)); = \ + OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); = \ set_float_exception_flags(0, &cpu->env.fp_status); = \ res =3D !float32_eq_quiet(fdt0, fdt1, &cpu->env.fp_status); = \ update_fpcsr(cpu); = \ @@ -253,7 +253,7 @@ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState= *env, \ uint64_t fdt0, uint64_t fdt1) = \ { = \ int res; = \ - OpenRISCCPU *cpu =3D OPENRISC_CPU(ENV_GET_CPU(env)); = \ + OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); = \ set_float_exception_flags(0, &cpu->env.fp_status); = \ res =3D !float64_le(fdt0, fdt1, &cpu->env.fp_status); = \ update_fpcsr(cpu); = \ @@ -264,7 +264,7 @@ uint32_t helper_float_ ## name ## _s(CPUOpenRISCState= *env, \ uint32_t fdt0, uint32_t fdt1) = \ { = \ int res; = \ - OpenRISCCPU *cpu =3D OPENRISC_CPU(ENV_GET_CPU(env)); = \ + OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); = \ set_float_exception_flags(0, &cpu->env.fp_status); = \ res =3D !float32_le(fdt0, fdt1, &cpu->env.fp_status); = \ update_fpcsr(cpu); = \ @@ -278,7 +278,7 @@ uint64_t helper_float_ ## name ## _d(CPUOpenRISCState= *env, \ uint64_t fdt0, uint64_t fdt1) = \ { = \ int res; = \ - OpenRISCCPU *cpu =3D OPENRISC_CPU(ENV_GET_CPU(env)); = \ + OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); = \ set_float_exception_flags(0, &cpu->env.fp_status); = \ res =3D !float64_lt(fdt0, fdt1, &cpu->env.fp_status); = \ update_fpcsr(cpu); = \ @@ -289,7 +289,7 @@ uint32_t helper_float_ ## name ## _s(CPUOpenRISCState= *env, \ uint32_t fdt0, uint32_t fdt1) = \ { = \ int res; = \ - OpenRISCCPU *cpu =3D OPENRISC_CPU(ENV_GET_CPU(env)); = \ + OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); = \ set_float_exception_flags(0, &cpu->env.fp_status); = \ res =3D !float32_lt(fdt0, fdt1, &cpu->env.fp_status); = \ update_fpcsr(cpu); = \ diff --git a/target-openrisc/int_helper.c b/target-openrisc/int_helper.c index 20f9837..16cb5ab 100644 --- a/target-openrisc/int_helper.c +++ b/target-openrisc/int_helper.c @@ -48,7 +48,7 @@ uint32_t HELPER(mul32)(CPUOpenRISCState *env, uint64_t result; uint32_t high, cy; =20 - OpenRISCCPU *cpu =3D OPENRISC_CPU(ENV_GET_CPU(env)); + OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); =20 result =3D (uint64_t)ra * rb; /* regisiers in or32 is 32bit, so 32 is NOT a magic number. diff --git a/target-openrisc/interrupt_helper.c b/target-openrisc/interru= pt_helper.c index 79f5afe..a176441 100644 --- a/target-openrisc/interrupt_helper.c +++ b/target-openrisc/interrupt_helper.c @@ -23,7 +23,7 @@ =20 void HELPER(rfe)(CPUOpenRISCState *env) { - OpenRISCCPU *cpu =3D OPENRISC_CPU(ENV_GET_CPU(env)); + OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); #ifndef CONFIG_USER_ONLY int need_flush_tlb =3D (cpu->env.sr & (SR_SM | SR_IME | SR_DME)) ^ (cpu->env.esr & (SR_SM | SR_IME | SR_DME)); diff --git a/target-openrisc/mmu.c b/target-openrisc/mmu.c index 8364652..d354e1f 100644 --- a/target-openrisc/mmu.c +++ b/target-openrisc/mmu.c @@ -187,7 +187,7 @@ int cpu_openrisc_handle_mmu_fault(CPUOpenRISCState *e= nv, int ret =3D 0; hwaddr physical =3D 0; int prot =3D 0; - OpenRISCCPU *cpu =3D OPENRISC_CPU(ENV_GET_CPU(env)); + OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); =20 ret =3D cpu_openrisc_get_phys_addr(cpu, &physical, &prot, address, rw); @@ -209,7 +209,7 @@ int cpu_openrisc_handle_mmu_fault(CPUOpenRISCState *e= nv, target_ulong address, int rw, int mmu_= idx) { int ret =3D 0; - OpenRISCCPU *cpu =3D OPENRISC_CPU(ENV_GET_CPU(env)); + OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); =20 cpu_openrisc_raise_mmu_exception(cpu, address, rw, ret); ret =3D 1; @@ -224,7 +224,7 @@ hwaddr cpu_get_phys_page_debug(CPUOpenRISCState *env, { hwaddr phys_addr; int prot; - OpenRISCCPU *cpu =3D OPENRISC_CPU(ENV_GET_CPU(env)); + OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); =20 if (cpu_openrisc_get_phys_addr(cpu, &phys_addr, &prot, addr, 0)) { return -1; diff --git a/target-openrisc/sys_helper.c b/target-openrisc/sys_helper.c index f160dc3..3c5f45a 100644 --- a/target-openrisc/sys_helper.c +++ b/target-openrisc/sys_helper.c @@ -30,7 +30,7 @@ void HELPER(mtspr)(CPUOpenRISCState *env, int spr =3D (ra | offset); int idx; =20 - OpenRISCCPU *cpu =3D OPENRISC_CPU(ENV_GET_CPU(env)); + OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); =20 switch (spr) { case TO_SPR(0, 0): /* VR */ @@ -177,7 +177,7 @@ target_ulong HELPER(mfspr)(CPUOpenRISCState *env, int spr =3D (ra | offset); int idx; =20 - OpenRISCCPU *cpu =3D OPENRISC_CPU(ENV_GET_CPU(env)); + OpenRISCCPU *cpu =3D openrisc_env_get_cpu(env); =20 switch (spr) { case TO_SPR(0, 0): /* VR */ --=20 1.7.10.4