From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KyLSv-0005eS-Jy for qemu-devel@nongnu.org; Fri, 07 Nov 2008 02:09:09 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KyLSu-0005eG-PK for qemu-devel@nongnu.org; Fri, 07 Nov 2008 02:09:09 -0500 Received: from [199.232.76.173] (port=45765 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KyLSu-0005eD-M5 for qemu-devel@nongnu.org; Fri, 07 Nov 2008 02:09:08 -0500 Received: from mx20.gnu.org ([199.232.41.8]:3715) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KyLSu-0006Tk-D5 for qemu-devel@nongnu.org; Fri, 07 Nov 2008 02:09:08 -0500 Received: from hall.aurel32.net ([88.191.82.174]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KyLSq-0008Cu-Jq for qemu-devel@nongnu.org; Fri, 07 Nov 2008 02:09:04 -0500 Received: from aurel32 by hall.aurel32.net with local (Exim 4.63) (envelope-from ) id 1KyLSe-0004V7-T4 for qemu-devel@nongnu.org; Fri, 07 Nov 2008 08:08:52 +0100 Date: Fri, 7 Nov 2008 08:08:52 +0100 From: Aurelien Jarno Subject: Re: [Qemu-devel] qemu-system-ppc broken ? Message-ID: <20081107070852.GA32665@hall.aurel32.net> References: <35733639105-BeMail@laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <35733639105-BeMail@laptop> Sender: Aurelien Jarno 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 On Fri, Nov 07, 2008 at 04:16:12AM +0100, François Revol wrote: > Just to let you know it seems the ppc target it broken as of r5643: > > $ qemu-system-ppc -M prep -serial stdio -k fr -vnc :8 -hda generated- > ppc-gcc4/haiku.image -cdrom generated-ppc-gcc4/haiku-boot-cd-ppc.iso > /home/revol/devel/qemu/trunk/tcg/tcg.c:1356: tcg fatal error > Abandon > > (image isn't bootable yet but at least it didn't crash lots of revs > before) > > I'm on debian stable on x86. > >>From what I see, it has been broken in revision 5493. It seems that the i386 TCG backend is not able to alloc/free a temp variable. The problem also occurs when in single step mode, when only *2* temp variables are allocated. The x86-64 TCG backend is not affected. The quick and dirty patch below is able to workaround the problem. Any one has an idea what happens? diff --git a/target-ppc/translate.c b/target-ppc/translate.c index a01ff89..f54225c 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -2588,52 +2588,42 @@ GEN_HANDLER(lq, 0x38, 0xFF, 0xFF, 0x00000000, PPC_64BX) #define GEN_ST(width, opc, type) \ GEN_HANDLER(st##width, opc, 0xFF, 0xFF, 0x00000000, type) \ { \ - TCGv EA = tcg_temp_new(TCG_TYPE_TL); \ - gen_addr_imm_index(EA, ctx, 0); \ - gen_qemu_st##width(cpu_gpr[rS(ctx->opcode)], EA, ctx->mem_idx); \ - tcg_temp_free(EA); \ + gen_addr_imm_index(cpu_T[0], ctx, 0); \ + gen_qemu_st##width(cpu_gpr[rS(ctx->opcode)], cpu_T[0], ctx->mem_idx); \ } #define GEN_STU(width, opc, type) \ GEN_HANDLER(st##width##u, opc, 0xFF, 0xFF, 0x00000000, type) \ { \ - TCGv EA; \ if (unlikely(rA(ctx->opcode) == 0)) { \ GEN_EXCP_INVAL(ctx); \ return; \ } \ - EA = tcg_temp_new(TCG_TYPE_TL); \ if (type == PPC_64B) \ - gen_addr_imm_index(EA, ctx, 0x03); \ + gen_addr_imm_index(cpu_T[0], ctx, 0x03); \ else \ - gen_addr_imm_index(EA, ctx, 0); \ - gen_qemu_st##width(cpu_gpr[rS(ctx->opcode)], EA, ctx->mem_idx); \ - tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], EA); \ - tcg_temp_free(EA); \ + gen_addr_imm_index(cpu_T[0], ctx, 0); \ + gen_qemu_st##width(cpu_gpr[rS(ctx->opcode)], cpu_T[0], ctx->mem_idx); \ + tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); \ } #define GEN_STUX(width, opc2, opc3, type) \ GEN_HANDLER(st##width##ux, 0x1F, opc2, opc3, 0x00000001, type) \ { \ - TCGv EA; \ if (unlikely(rA(ctx->opcode) == 0)) { \ GEN_EXCP_INVAL(ctx); \ return; \ } \ - EA = tcg_temp_new(TCG_TYPE_TL); \ - gen_addr_reg_index(EA, ctx); \ - gen_qemu_st##width(cpu_gpr[rS(ctx->opcode)], EA, ctx->mem_idx); \ - tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], EA); \ - tcg_temp_free(EA); \ + gen_addr_reg_index(cpu_T[0], ctx); \ + gen_qemu_st##width(cpu_gpr[rS(ctx->opcode)], cpu_T[0], ctx->mem_idx); \ + tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); \ } #define GEN_STX(width, opc2, opc3, type) \ GEN_HANDLER(st##width##x, 0x1F, opc2, opc3, 0x00000001, type) \ { \ - TCGv EA = tcg_temp_new(TCG_TYPE_TL); \ - gen_addr_reg_index(EA, ctx); \ - gen_qemu_st##width(cpu_gpr[rS(ctx->opcode)], EA, ctx->mem_idx); \ - tcg_temp_free(EA); \ + gen_addr_reg_index(cpu_T[0], ctx); \ + gen_qemu_st##width(cpu_gpr[rS(ctx->opcode)], cpu_T[0], ctx->mem_idx); \ } #define GEN_STS(width, op, type) \ -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' aurel32@debian.org | aurelien@aurel32.net `- people.debian.org/~aurel32 | www.aurel32.net