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: Peter Maydell
Subject: Re: [Qemu-devel] MIPS 'move' insn emulation
Date: Thu, 14 Sep 2017 14:58:50 +0100

On 14 September 2017 at 14:49, Sergey Smolov <address@hidden> wrote:
> 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?:-)

At translate time it is generating some extra code which at runtime
will call the helper_trace_reg_access() function, passing it the
values in the registers at this point. This will result in poor
performance if you do it for frequently executed instructions.

> 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?

That looks like it ought to work. Check you really did save all your
files in your editor before compiling? :-)

PS: there's no point passing the env pointer into the function if
you're not going to use it...

thanks
-- PMM



reply via email to

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