From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45368) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drmFV-0004ry-2f for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:33:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1drmFP-0000yU-9w for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:33:13 -0400 Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]:45965) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1drmFP-0000xk-32 for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:33:07 -0400 Received: by mail-wm0-x22d.google.com with SMTP id f199so58818566wme.0 for ; Tue, 12 Sep 2017 07:33:06 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <59B7EBC5.9060908@ispras.ru> References: <59B7EBC5.9060908@ispras.ru> From: Peter Maydell Date: Tue, 12 Sep 2017 15:32:45 +0100 Message-ID: Content-Type: text/plain; charset="UTF-8" Subject: Re: [Qemu-devel] MIPS 'move' insn emulation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sergey Smolov Cc: QEMU Developers On 12 September 2017 at 15:14, Sergey Smolov wrote: > I've the code I probably need to modify in target/mips/translate.c: > > [code] > > static void gen_logic(DisasContext *ctx, uint32_t opc, > int rd, int rs, int rt) > { > ... > } else if (rs != 0 && rt == 0) { > tcg_gen_mov_tl(cpu_gpr[rd], cpu_gpr[rs]); > } > > [/code] > > I suppose that for my assembler program cpu_gpr[rs] here should contain 0x7 > value at runtime. Is it possible to extract this value somehow? I've tried > the following constructions: > > GET_TCG_I32(cpu_gpr[rs]) > ((CPUMIPSState *)tcg_ctx.cpu)->active_tc.gpr[rs] > > but they do not provide me the correct value. You can't do this in this bit of the code. The functions in translate.c are called at "translate time", when we convert MIPS assembly into x86 code to run on the host. At this point we don't know what the values in MIPS registers are, because we're generating code that will later be run multiple times perhaps with different values. The register contents are only known later, at "run time". thanks -- PMM