qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Sergey Smolov <smolov@ispras.ru>
To: Yongbok Kim <yongbok.kim@imgtec.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] MIPS 'move' insn emulation
Date: Thu, 14 Sep 2017 19:32:29 +0300	[thread overview]
Message-ID: <59BAAF1D.8070801@ispras.ru> (raw)
In-Reply-To: <5cea7ccd-97b3-ecbf-22c1-72b329c467fc@imgtec.com>


On 14.09.2017 17:23, Yongbok Kim wrote:
>
> On 14/09/2017 15:16, Sergey Smolov wrote:
>> On 14.09.2017 16:58, Peter Maydell wrote:
>>> 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.
> Yes indeed. it will be hitting the performance critically the instruction
> is quite often used. :)
>
>> Ok, thank you.
>>
>>> That looks like it ought to work. Check you really did save all your
>>> files in your editor before compiling? :-)
>> Yes, I did. These warnings are very suspicious, because they come with
>> strange numbers of MIPS GPR registers that I receive for my program.
>>
>> Here is the program:
>>
>> .text
>>      addiu $8, $zero, 0x7
>>      move $9, $8
>>      sll $8, $8, 3
>>      add $8, $8, $9
>>
>> Here is the log that helper functions provide:
>>
>> $0 00000007
>> $7 00000007
>> $0 00000038
>> $0 0000003f
>>
>> The first value is register name, the second is the value to be written.
>> Values are ok, but I expect to see $8 and $9  registers here.
>>
>>> PS: there's no point passing the env pointer into the function if
>>> you're not going to use it...
> Yes you're right. I had further use of the env but it has been chopped for
> the example.
>
>> I thought that I need to pass env pointer to helper function because of
>> some convention. Again, thank you for the note.
>>
> Sergey,
>
> The reason why your modification is failed is because you passed wrong
> argument. Remember that you are not just calling the helper function from
> translate.c but you are generating some code to let call the helper
> function on run time. You have to create a temporal TCGv to pass the
> register number.
> You could do it like,
> TCGv_i32 tmp = tcg_const_i32(rd)
> gen_helper_trace_reg_access(cpu_env, tmp, cpu_gpr[rs);
> tcg_temp_free_i32(tmp);
>
> or simply use the predefined macro and fix the order of the arguments.
>
> gen_helper_0e1i(trace_reg_access, cpu_gpr[rs], rd);
>
> Regards,
> Yongbok

It helps!

Thank you both for detailed explanations:-)

-- 
Sincerely yours,
Sergey Smolov

      parent reply	other threads:[~2017-09-14 16:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=59BAAF1D.8070801@ispras.ru \
    --to=smolov@ispras.ru \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=yongbok.kim@imgtec.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).