qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] When are register values committed to CPUARMState


From: Peter Maydell
Subject: Re: [Qemu-devel] When are register values committed to CPUARMState
Date: Mon, 31 Mar 2014 19:05:29 +0100

On 31 March 2014 18:59, Gaurav Sharma <address@hidden> wrote:
> I am trying to build a register trace for ARM target.
> I am trying to just log the register values, for that I added TCG ops to
> generate a helper function that dumps the register values in CPUARMState.
> This helper function i have called at the end of disas_arm_state function,
> so that if enabled i get a trace for each instruction.
> However, the register values that are dumped do not seem to be correct, it
> always the register at the 0th index that seems to have any value, even
> though the disassembly indicates otherwise.
> I want to know, when are the register values committed to  CPUARMState
> structure ?

When they need to be. Mostly we keep register values in TCG
globals, which means they're held in host registers except
when calling helpers which might read or write globals, or
for doing guest memory accesses, or at branches. Thumb
condexec bits (in the CPSR) are only written back at the
point where we leave a translation block. The PC is a special
case which we don't update very often at all.

> Is there any way , i could find out the register values that
> have changed for any instruction ?

Not conveniently. We optimise for speed of execution, not
for transparency of what is happening to the guest CPU.
(It can be done, and people have done it, but none of this
support is upstream, because it's usually a lot of local
and special-purpose hacks.)

You might consider just connecting to the gdbstub and
singlestepping the CPU and using the gdbstub protocol
to read register values.

thanks
-- PMM



reply via email to

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