* [Qemu-devel] Changing the content of target cpu registers
@ 2011-01-18 9:29 Stefano Bonifazi
2011-01-18 17:17 ` Blue Swirl
0 siblings, 1 reply; 5+ messages in thread
From: Stefano Bonifazi @ 2011-01-18 9:29 UTC (permalink / raw)
To: QEMU Developers
Hi all!
I am working on qemu-user (qemu-ppc).
I'd like to edit the values of target registers during the execution.
Can I do that by simply changing the content of env->gpr[] or do these
only contain a copy of the values of the registers?
In this last case, where are the real values of the target registers
stored so that by modifying them I can alter the behavior of the target
code execution?
Thank you in advance!
Stefano B.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] Changing the content of target cpu registers
2011-01-18 9:29 [Qemu-devel] Changing the content of target cpu registers Stefano Bonifazi
@ 2011-01-18 17:17 ` Blue Swirl
2011-01-18 18:13 ` Stefano Bonifazi
0 siblings, 1 reply; 5+ messages in thread
From: Blue Swirl @ 2011-01-18 17:17 UTC (permalink / raw)
To: Stefano Bonifazi; +Cc: QEMU Developers
On Tue, Jan 18, 2011 at 9:29 AM, Stefano Bonifazi
<stefboombastic@gmail.com> wrote:
> Hi all!
> I am working on qemu-user (qemu-ppc).
> I'd like to edit the values of target registers during the execution. Can I
> do that by simply changing the content of env->gpr[] or do these only
> contain a copy of the values of the registers?
> In this last case, where are the real values of the target registers stored
> so that by modifying them I can alter the behavior of the target code
> execution?
env->gpr is the canonical location, but the translator assigns TCG
variables to them (cpu_gpr[] in translate.c), so GPR contents may be
cached to these. But when helpers are called or the TB finishes,
env->gpr should be valid again.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] Changing the content of target cpu registers
2011-01-18 17:17 ` Blue Swirl
@ 2011-01-18 18:13 ` Stefano Bonifazi
2011-01-21 22:41 ` Raphaël Lefèvre
0 siblings, 1 reply; 5+ messages in thread
From: Stefano Bonifazi @ 2011-01-18 18:13 UTC (permalink / raw)
To: Blue Swirl; +Cc: QEMU Developers
On 01/18/2011 06:17 PM, Blue Swirl wrote:
> On Tue, Jan 18, 2011 at 9:29 AM, Stefano Bonifazi
> <stefboombastic@gmail.com> wrote:
>> Hi all!
>> I am working on qemu-user (qemu-ppc).
>> I'd like to edit the values of target registers during the execution. Can I
>> do that by simply changing the content of env->gpr[] or do these only
>> contain a copy of the values of the registers?
>> In this last case, where are the real values of the target registers stored
>> so that by modifying them I can alter the behavior of the target code
>> execution?
> env->gpr is the canonical location, but the translator assigns TCG
> variables to them (cpu_gpr[] in translate.c), so GPR contents may be
> cached to these. But when helpers are called or the TB finishes,
> env->gpr should be valid again.
Hi!
Thank you for your answer!
So if I understand well if I set env->gpr in a code section where there
is no TCG translation on progress, I can edit directly the target CPU
register right?
Best Regards!
Stefano B.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] Changing the content of target cpu registers
2011-01-18 18:13 ` Stefano Bonifazi
@ 2011-01-21 22:41 ` Raphaël Lefèvre
2011-01-22 19:35 ` Blue Swirl
0 siblings, 1 reply; 5+ messages in thread
From: Raphaël Lefèvre @ 2011-01-21 22:41 UTC (permalink / raw)
Cc: Blue Swirl, QEMU Developers
On Wed, Jan 19, 2011 at 2:13 AM, Stefano Bonifazi
<stefboombastic@gmail.com> wrote:
> On 01/18/2011 06:17 PM, Blue Swirl wrote:
>>
>> On Tue, Jan 18, 2011 at 9:29 AM, Stefano Bonifazi
>> <stefboombastic@gmail.com> wrote:
>>>
>>> Hi all!
>>> I am working on qemu-user (qemu-ppc).
>>> I'd like to edit the values of target registers during the execution. Can
>>> I
>>> do that by simply changing the content of env->gpr[] or do these only
>>> contain a copy of the values of the registers?
>>> In this last case, where are the real values of the target registers
>>> stored
>>> so that by modifying them I can alter the behavior of the target code
>>> execution?
>>
>> env->gpr is the canonical location, but the translator assigns TCG
>> variables to them (cpu_gpr[] in translate.c), so GPR contents may be
>> cached to these. But when helpers are called or the TB finishes,
>> env->gpr should be valid again.
>
> Hi!
> Thank you for your answer!
> So if I understand well if I set env->gpr in a code section where there is
> no TCG translation on progress, I can edit directly the target CPU register
> right?
> Best Regards!
> Stefano B.
>
>
In fact, I need to apologize for my poor comprehension to your
questions even after digesting the explinations from Blue Swirl. By
tracing code of qemu, "env->gpr" should be able to be modified any
place directly(or indirectly) whether the TCG involved or not.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] Changing the content of target cpu registers
2011-01-21 22:41 ` Raphaël Lefèvre
@ 2011-01-22 19:35 ` Blue Swirl
0 siblings, 0 replies; 5+ messages in thread
From: Blue Swirl @ 2011-01-22 19:35 UTC (permalink / raw)
To: Raphaël Lefèvre; +Cc: QEMU Developers
2011/1/21 Raphaël Lefèvre <taylor.lefevre@gmail.com>:
> On Wed, Jan 19, 2011 at 2:13 AM, Stefano Bonifazi
> <stefboombastic@gmail.com> wrote:
>> On 01/18/2011 06:17 PM, Blue Swirl wrote:
>>>
>>> On Tue, Jan 18, 2011 at 9:29 AM, Stefano Bonifazi
>>> <stefboombastic@gmail.com> wrote:
>>>>
>>>> Hi all!
>>>> I am working on qemu-user (qemu-ppc).
>>>> I'd like to edit the values of target registers during the execution. Can
>>>> I
>>>> do that by simply changing the content of env->gpr[] or do these only
>>>> contain a copy of the values of the registers?
>>>> In this last case, where are the real values of the target registers
>>>> stored
>>>> so that by modifying them I can alter the behavior of the target code
>>>> execution?
>>>
>>> env->gpr is the canonical location, but the translator assigns TCG
>>> variables to them (cpu_gpr[] in translate.c), so GPR contents may be
>>> cached to these. But when helpers are called or the TB finishes,
>>> env->gpr should be valid again.
>>
>> Hi!
>> Thank you for your answer!
>> So if I understand well if I set env->gpr in a code section where there is
>> no TCG translation on progress, I can edit directly the target CPU register
>> right?
>> Best Regards!
>> Stefano B.
>>
>>
>
> In fact, I need to apologize for my poor comprehension to your
> questions even after digesting the explinations from Blue Swirl. By
> tracing code of qemu, "env->gpr" should be able to be modified any
> place directly(or indirectly) whether the TCG involved or not.
Not exactly: you can't mix TCGv cpu_gpr[x] variable use with
env->gpr[x] access using tcg_gen_{ld,st}_tl(foo, cpu_env,
offsetof(CPUState, gpr[x])). The loads/stores would use env->gpr[x]
directly, bypassing possibly cached values in registers assigned by
TCG.
This may be visible by tracing the generated code, not code in
cpu-exec.c or op_helper.c.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-01-22 19:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-18 9:29 [Qemu-devel] Changing the content of target cpu registers Stefano Bonifazi
2011-01-18 17:17 ` Blue Swirl
2011-01-18 18:13 ` Stefano Bonifazi
2011-01-21 22:41 ` Raphaël Lefèvre
2011-01-22 19:35 ` Blue Swirl
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).