Received: from eggs.gnu.org ([208.118.235.92]:37822) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SiZQt-0007Ab-UR for qemu-devel@nongnu.org; Sat, 23 Jun 2012 19:08:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SiZQp-0002HE-3w for qemu-devel@nongnu.org; Sat, 23 Jun 2012 19:07:59 -0400 From: Alexander Graf Date: Sun, 24 Jun 2012 01:06:41 +0200 Message-Id: <1340492856-21126-18-git-send-email-agraf@suse.de> In-Reply-To: <1340492856-21126-1-git-send-email-agraf@suse.de> References: <1340492856-21126-1-git-send-email-agraf@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 17/72] ppc: Split off misc helpers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel qemu-devel Cc: Blue Swirl , qemu-ppc Mailing List , =?utf-8?q?Andreas=20F=C3=A4rber?= , Aurelien Jarno From: Blue Swirl Move misc helpers from op_helper.c to misc_helpers.c. Signed-off-by: Blue Swirl Signed-off-by: Alexander Graf Signed-off-by: Andreas F=C3=A4rber Signed-off-by: Alexander Graf --- target-ppc/Makefile.objs | 2 + target-ppc/misc_helper.c | 116 ++++++++++++++++++++++++++++++++++++++++= ++++++ target-ppc/op_helper.c | 94 ------------------------------------- 3 files changed, 118 insertions(+), 94 deletions(-) create mode 100644 target-ppc/misc_helper.c diff --git a/target-ppc/Makefile.objs b/target-ppc/Makefile.objs index 4a88641..3a444eb 100644 --- a/target-ppc/Makefile.objs +++ b/target-ppc/Makefile.objs @@ -7,5 +7,7 @@ obj-y +=3D fpu_helper.o obj-y +=3D int_helper.o obj-y +=3D mmu_helper.o obj-y +=3D timebase_helper.o +obj-y +=3D misc_helper.o =20 +$(obj)/misc_helper.o: QEMU_CFLAGS +=3D $(HELPER_CFLAGS) $(obj)/op_helper.o: QEMU_CFLAGS +=3D $(HELPER_CFLAGS) diff --git a/target-ppc/misc_helper.c b/target-ppc/misc_helper.c new file mode 100644 index 0000000..67eab08 --- /dev/null +++ b/target-ppc/misc_helper.c @@ -0,0 +1,116 @@ +/* + * Miscellaneous PowerPC emulation helpers for QEMU. + * + * Copyright (c) 2003-2007 Jocelyn Mayer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ +#include "cpu.h" +#include "dyngen-exec.h" +#include "helper.h" + +#include "helper_regs.h" + +/***********************************************************************= ******/ +/* SPR accesses */ +void helper_load_dump_spr(uint32_t sprn) +{ + qemu_log("Read SPR %d %03x =3D> " TARGET_FMT_lx "\n", sprn, sprn, + env->spr[sprn]); +} + +void helper_store_dump_spr(uint32_t sprn) +{ + qemu_log("Write SPR %d %03x <=3D " TARGET_FMT_lx "\n", sprn, sprn, + env->spr[sprn]); +} +#if !defined(CONFIG_USER_ONLY) +#if defined(TARGET_PPC64) +void helper_store_asr(target_ulong val) +{ + ppc_store_asr(env, val); +} +#endif + +void helper_store_sdr1(target_ulong val) +{ + ppc_store_sdr1(env, val); +} + +void helper_store_hid0_601(target_ulong val) +{ + target_ulong hid0; + + hid0 =3D env->spr[SPR_HID0]; + if ((val ^ hid0) & 0x00000008) { + /* Change current endianness */ + env->hflags &=3D ~(1 << MSR_LE); + env->hflags_nmsr &=3D ~(1 << MSR_LE); + env->hflags_nmsr |=3D (1 << MSR_LE) & (((val >> 3) & 1) << MSR_L= E); + env->hflags |=3D env->hflags_nmsr; + qemu_log("%s: set endianness to %c =3D> " TARGET_FMT_lx "\n", __= func__, + val & 0x8 ? 'l' : 'b', env->hflags); + } + env->spr[SPR_HID0] =3D (uint32_t)val; +} + +void helper_store_403_pbr(uint32_t num, target_ulong value) +{ + if (likely(env->pb[num] !=3D value)) { + env->pb[num] =3D value; + /* Should be optimized */ + tlb_flush(env, 1); + } +} + +void helper_store_40x_dbcr0(target_ulong val) +{ + store_40x_dbcr0(env, val); +} + +void helper_store_40x_sler(target_ulong val) +{ + store_40x_sler(env, val); +} +#endif +/***********************************************************************= ******/ +/* PowerPC 601 specific instructions (POWER bridge) */ + +target_ulong helper_clcs(uint32_t arg) +{ + switch (arg) { + case 0x0CUL: + /* Instruction cache line size */ + return env->icache_line_size; + break; + case 0x0DUL: + /* Data cache line size */ + return env->dcache_line_size; + break; + case 0x0EUL: + /* Minimum cache line size */ + return (env->icache_line_size < env->dcache_line_size) ? + env->icache_line_size : env->dcache_line_size; + break; + case 0x0FUL: + /* Maximum cache line size */ + return (env->icache_line_size > env->dcache_line_size) ? + env->icache_line_size : env->dcache_line_size; + break; + default: + /* Undefined */ + return 0; + break; + } +} diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c index 0929906..cd1a533 100644 --- a/target-ppc/op_helper.c +++ b/target-ppc/op_helper.c @@ -31,69 +31,6 @@ //#define DEBUG_OP =20 /***********************************************************************= ******/ -/* SPR accesses */ -void helper_load_dump_spr(uint32_t sprn) -{ - qemu_log("Read SPR %d %03x =3D> " TARGET_FMT_lx "\n", sprn, sprn, - env->spr[sprn]); -} - -void helper_store_dump_spr(uint32_t sprn) -{ - qemu_log("Write SPR %d %03x <=3D " TARGET_FMT_lx "\n", sprn, sprn, - env->spr[sprn]); -} -#if !defined(CONFIG_USER_ONLY) -#if defined(TARGET_PPC64) -void helper_store_asr(target_ulong val) -{ - ppc_store_asr(env, val); -} -#endif - -void helper_store_sdr1(target_ulong val) -{ - ppc_store_sdr1(env, val); -} - -void helper_store_hid0_601(target_ulong val) -{ - target_ulong hid0; - - hid0 =3D env->spr[SPR_HID0]; - if ((val ^ hid0) & 0x00000008) { - /* Change current endianness */ - env->hflags &=3D ~(1 << MSR_LE); - env->hflags_nmsr &=3D ~(1 << MSR_LE); - env->hflags_nmsr |=3D (1 << MSR_LE) & (((val >> 3) & 1) << MSR_L= E); - env->hflags |=3D env->hflags_nmsr; - qemu_log("%s: set endianness to %c =3D> " TARGET_FMT_lx "\n", __= func__, - val & 0x8 ? 'l' : 'b', env->hflags); - } - env->spr[SPR_HID0] =3D (uint32_t)val; -} - -void helper_store_403_pbr(uint32_t num, target_ulong value) -{ - if (likely(env->pb[num] !=3D value)) { - env->pb[num] =3D value; - /* Should be optimized */ - tlb_flush(env, 1); - } -} - -void helper_store_40x_dbcr0(target_ulong val) -{ - store_40x_dbcr0(env, val); -} - -void helper_store_40x_sler(target_ulong val) -{ - store_40x_sler(env, val); -} -#endif - -/***********************************************************************= ******/ /* Memory load and stores */ =20 static inline target_ulong addr_add(target_ulong addr, target_long arg) @@ -252,37 +189,6 @@ target_ulong helper_lscbx(target_ulong addr, uint32_= t reg, uint32_t ra, } =20 /***********************************************************************= ******/ -/* PowerPC 601 specific instructions (POWER bridge) */ - -target_ulong helper_clcs(uint32_t arg) -{ - switch (arg) { - case 0x0CUL: - /* Instruction cache line size */ - return env->icache_line_size; - break; - case 0x0DUL: - /* Data cache line size */ - return env->dcache_line_size; - break; - case 0x0EUL: - /* Minimum cache line size */ - return (env->icache_line_size < env->dcache_line_size) ? - env->icache_line_size : env->dcache_line_size; - break; - case 0x0FUL: - /* Maximum cache line size */ - return (env->icache_line_size > env->dcache_line_size) ? - env->icache_line_size : env->dcache_line_size; - break; - default: - /* Undefined */ - return 0; - break; - } -} - -/***********************************************************************= ******/ /* Altivec extension helpers */ #if defined(HOST_WORDS_BIGENDIAN) #define HI_IDX 0 --=20 1.6.0.2