qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] MIPS 'move' insn emulation
@ 2017-09-12 14:14 Sergey Smolov
  2017-09-12 14:32 ` Peter Maydell
  0 siblings, 1 reply; 13+ messages in thread
From: Sergey Smolov @ 2017-09-12 14:14 UTC (permalink / raw)
  To: QEMU Developers

Hello, List!

I run MIPS assembler program on QEMU. The program is just a sample, here 
is the code:

.text
     addiu $8, $zero, 0x7
     move $9, $8
     sll $8, $8, 3
     add $8, $8, $9

The program finishes on QEMU with the following values for registers, 
and it's ok:

$8 - 0x3f
$9 - 0x7

Now I want to implement some logging features for MIPS assembler 
programs. For example, I want to write a record to log every time the 
'move' instruction writes some value to GPR register.

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. Could you help me in 
solving this problem?

Thanks in advance,
  Sergey Smolov

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-09-14 16:32 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-12 14:14 [Qemu-devel] MIPS 'move' insn emulation Sergey Smolov
2017-09-12 14:32 ` Peter Maydell
2017-09-12 14:53   ` Sergey Smolov
2017-09-12 15:06     ` Peter Maydell
2017-09-13  7:29       ` Sergey Smolov
2017-09-13 11:01         ` Peter Maydell
2017-09-13 14:20           ` Yongbok Kim
2017-09-14 13:49             ` Sergey Smolov
2017-09-14 13:58               ` Peter Maydell
2017-09-14 14:16                 ` Sergey Smolov
2017-09-14 14:23                   ` Yongbok Kim
2017-09-14 14:29                     ` Peter Maydell
2017-09-14 16:32                     ` Sergey Smolov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).