qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] MIPS 'move' insn emulation


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


On 13.09.2017 17:20, Yongbok Kim wrote:
(Especially while implementing new instructions), I tended to add couple of
helper functions for tracing temporally.

op_helper.c:
void helper_trace_reg_access(CPUMIPSState *env, target_ulong val)
{
     printf("reg = "TARGET_FMT_lx"\n", val);
}

helper.h:
DEF_HELPER_2(trace_reg_access, void, env, tl)

After this you could use the helper function where you want to trace the
register value.
For your case, you can add following line after the tcg_gen_mov_tl().
gen_helper_trace_reg_access(cpu_env, cpu_gpr[rs]);

You will get the printf every time the part of code is being executed
(which might be too often).

Regards,
Yongbok

Thanks, Yongbok!

I've implemented the code you've written. Now I receive values are written into MIPS registers.

Could you explain some aspects about the code you propose?

First, what is the helper function itself? Peter said that it is impossible to get the value that is written to MIPS register at "translation time", but in "run time" there is no mapping between x86 and "virtual MIPS" registers. So how it is possible to get these values?:-)

Second, I need to make a final modification of helper function. I need to print both "val" that is written to GPR register and the number "num" of the register. I wrote the following:

op_helper.c:
void helper_trace_reg_access(CPUMIPSState *env, int reg, target_ulong val)
{
qemu_log("r%d = "TARGET_FMT_lx"\n", reg, val);
}

helper.h:
DEF_HELPER_3(trace_reg_access, void, env, int, tl)

and call the function in translate.c like:

gen_helper_trace_reg_access(cpu_env, rd, cpu_gpr[rs]);

But when I compile the QEMU, i get this:
In function ‘gen_logic’:
target/mips/translate.c:2913:13: warning: passing argument 2 of ‘gen_helper_trace_reg_access’ makes pointer from integer without a cast [enabled by default]

What am I missing here?

--
Sincerely yours,
Sergey Smolov




reply via email to

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