qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] MIPS 'move' insn emulation


From: Sergey Smolov
Subject: [Qemu-devel] MIPS 'move' insn emulation
Date: Tue, 12 Sep 2017 17:14:29 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120713 Thunderbird/14.0

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]