Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L6p5j-0006j7-Nw for qemu-devel@nongnu.org; Sun, 30 Nov 2008 11:24:15 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L6p5j-0006ia-4w for qemu-devel@nongnu.org; Sun, 30 Nov 2008 11:24:15 -0500 Received: from [199.232.76.173] (port=39017 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L6p5i-0006iR-Pz for qemu-devel@nongnu.org; Sun, 30 Nov 2008 11:24:14 -0500 Received: from savannah.gnu.org ([199.232.41.3]:48800 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L6p5i-00071B-H4 for qemu-devel@nongnu.org; Sun, 30 Nov 2008 11:24:14 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1L6p5i-0005xr-2r for qemu-devel@nongnu.org; Sun, 30 Nov 2008 16:24:14 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1L6p5h-0005xm-Na for qemu-devel@nongnu.org; Sun, 30 Nov 2008 16:24:14 +0000 MIME-Version: 1.0 Errors-To: aurel32 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Aurelien Jarno Message-Id: Date: Sun, 30 Nov 2008 16:24:13 +0000 Subject: [Qemu-devel] [5827] target-ppc: convert icbi instruction to TCG Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 5827 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5827 Author: aurel32 Date: 2008-11-30 16:24:13 +0000 (Sun, 30 Nov 2008) Log Message: ----------- target-ppc: convert icbi instruction to TCG Signed-off-by: Aurelien Jarno Modified Paths: -------------- trunk/target-ppc/helper.h trunk/target-ppc/op_helper.c trunk/target-ppc/op_helper.h trunk/target-ppc/op_helper_mem.h trunk/target-ppc/op_mem.h trunk/target-ppc/translate.c Modified: trunk/target-ppc/helper.h =================================================================== --- trunk/target-ppc/helper.h 2008-11-30 16:24:05 UTC (rev 5826) +++ trunk/target-ppc/helper.h 2008-11-30 16:24:13 UTC (rev 5827) @@ -11,6 +11,7 @@ DEF_HELPER_2(stmw, void, tl, i32) DEF_HELPER_1(dcbz, void, tl) DEF_HELPER_1(dcbz_970, void, tl) +DEF_HELPER_1(icbi, void, tl) DEF_HELPER_2(fcmpo, i32, i64, i64) DEF_HELPER_2(fcmpu, i32, i64, i64) Modified: trunk/target-ppc/op_helper.c =================================================================== --- trunk/target-ppc/op_helper.c 2008-11-30 16:24:05 UTC (rev 5826) +++ trunk/target-ppc/op_helper.c 2008-11-30 16:24:13 UTC (rev 5827) @@ -210,6 +210,32 @@ do_dcbz(addr, env->dcache_line_size); } +void helper_icbi(target_ulong addr) +{ + uint32_t tmp; + + addr = get_addr(addr & ~(env->dcache_line_size - 1)); + /* Invalidate one cache line : + * PowerPC specification says this is to be treated like a load + * (not a fetch) by the MMU. To be sure it will be so, + * do the load "by hand". + */ +#ifdef CONFIG_USER_ONLY + tmp = ldl_raw(addr); +#else + switch (env->mmu_idx) { + default: + case 0: tmp = ldl_user(addr); + break; + case 1: tmp = ldl_kernel(addr); + break; + case 2: tmp = ldl_hypv(addr); + break; + } +#endif + tb_invalidate_page_range(addr, addr + env->icache_line_size); +} + /*****************************************************************************/ /* Fixed point operations helpers */ #if defined(TARGET_PPC64) Modified: trunk/target-ppc/op_helper.h =================================================================== --- trunk/target-ppc/op_helper.h 2008-11-30 16:24:05 UTC (rev 5826) +++ trunk/target-ppc/op_helper.h 2008-11-30 16:24:13 UTC (rev 5827) @@ -23,7 +23,6 @@ /* Memory load/store helpers */ void glue(do_lsw, MEMSUFFIX) (int dst); void glue(do_stsw, MEMSUFFIX) (int src); -void glue(do_icbi, MEMSUFFIX) (void); void glue(do_POWER_lscbx, MEMSUFFIX) (int dest, int ra, int rb); void glue(do_POWER2_lfq, MEMSUFFIX) (void); void glue(do_POWER2_lfq_le, MEMSUFFIX) (void); @@ -33,7 +32,6 @@ #if defined(TARGET_PPC64) void glue(do_lsw_64, MEMSUFFIX) (int dst); void glue(do_stsw_64, MEMSUFFIX) (int src); -void glue(do_icbi_64, MEMSUFFIX) (void); #endif #else Modified: trunk/target-ppc/op_helper_mem.h =================================================================== --- trunk/target-ppc/op_helper_mem.h 2008-11-30 16:24:05 UTC (rev 5826) +++ trunk/target-ppc/op_helper_mem.h 2008-11-30 16:24:13 UTC (rev 5827) @@ -92,37 +92,6 @@ } #endif -/* Instruction cache invalidation helper */ -void glue(do_icbi, MEMSUFFIX) (void) -{ - uint32_t tmp; - /* Invalidate one cache line : - * PowerPC specification says this is to be treated like a load - * (not a fetch) by the MMU. To be sure it will be so, - * do the load "by hand". - */ - T0 &= ~(env->icache_line_size - 1); - tmp = glue(ldl, MEMSUFFIX)((uint32_t)T0); - tb_invalidate_page_range((uint32_t)T0, - (uint32_t)(T0 + env->icache_line_size)); -} - -#if defined(TARGET_PPC64) -void glue(do_icbi_64, MEMSUFFIX) (void) -{ - uint64_t tmp; - /* Invalidate one cache line : - * PowerPC specification says this is to be treated like a load - * (not a fetch) by the MMU. To be sure it will be so, - * do the load "by hand". - */ - T0 &= ~(env->icache_line_size - 1); - tmp = glue(ldq, MEMSUFFIX)((uint64_t)T0); - tb_invalidate_page_range((uint64_t)T0, - (uint64_t)(T0 + env->icache_line_size)); -} -#endif - /* PowerPC 601 specific instructions (POWER bridge) */ // XXX: to be tested void glue(do_POWER_lscbx, MEMSUFFIX) (int dest, int ra, int rb) Modified: trunk/target-ppc/op_mem.h =================================================================== --- trunk/target-ppc/op_mem.h 2008-11-30 16:24:05 UTC (rev 5826) +++ trunk/target-ppc/op_mem.h 2008-11-30 16:24:13 UTC (rev 5827) @@ -314,21 +314,6 @@ } #endif -/* Instruction cache block invalidate */ -void OPPROTO glue(op_icbi, MEMSUFFIX) (void) -{ - glue(do_icbi, MEMSUFFIX)(); - RETURN(); -} - -#if defined(TARGET_PPC64) -void OPPROTO glue(op_icbi_64, MEMSUFFIX) (void) -{ - glue(do_icbi_64, MEMSUFFIX)(); - RETURN(); -} -#endif - /* External access */ void OPPROTO glue(op_eciwx, MEMSUFFIX) (void) { Modified: trunk/target-ppc/translate.c =================================================================== --- trunk/target-ppc/translate.c 2008-11-30 16:24:05 UTC (rev 5826) +++ trunk/target-ppc/translate.c 2008-11-30 16:24:13 UTC (rev 5827) @@ -4165,25 +4165,14 @@ } /* icbi */ -#define op_icbi() (*gen_op_icbi[ctx->mem_idx])() -#define gen_op_icbi_le_raw gen_op_icbi_raw -#define gen_op_icbi_le_user gen_op_icbi_user -#define gen_op_icbi_le_kernel gen_op_icbi_kernel -#define gen_op_icbi_le_hypv gen_op_icbi_hypv -#define gen_op_icbi_le_64_raw gen_op_icbi_64_raw -#define gen_op_icbi_le_64_user gen_op_icbi_64_user -#define gen_op_icbi_le_64_kernel gen_op_icbi_64_kernel -#define gen_op_icbi_le_64_hypv gen_op_icbi_64_hypv -static GenOpFunc *gen_op_icbi[NB_MEM_FUNCS] = { - GEN_MEM_FUNCS(icbi), -}; - GEN_HANDLER(icbi, 0x1F, 0x16, 0x1E, 0x03E00001, PPC_CACHE_ICBI) { + TCGv t0 = tcg_temp_new(); /* NIP cannot be restored if the memory exception comes from an helper */ gen_update_nip(ctx, ctx->nip - 4); - gen_addr_reg_index(cpu_T[0], ctx); - op_icbi(); + gen_addr_reg_index(t0, ctx); + gen_helper_icbi(t0); + tcg_temp_free(t0); } /* Optional: */