qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Gaurav Sharma <gauravs.2010@gmail.com>
Cc: QEMU-DEVEL <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] When are register values committed to CPUARMState
Date: Mon, 31 Mar 2014 19:05:29 +0100	[thread overview]
Message-ID: <CAFEAcA-ANKm_Cu7fLdCuvE+cpRJkoQMAM93+TspQRsMGhZkkrQ@mail.gmail.com> (raw)
In-Reply-To: <CABiB5K5H1F9Yj1z+5eFf+nphyuhQk0taSS7ALLN=reCA_4UrmQ@mail.gmail.com>

On 31 March 2014 18:59, Gaurav Sharma <gauravs.2010@gmail.com> 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	other threads:[~2014-03-31 18:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-31 17:59 [Qemu-devel] When are register values committed to CPUARMState Gaurav Sharma
2014-03-31 18:05 ` Peter Maydell [this message]
     [not found]   ` <CABiB5K6F9hrJ9mhmxDCNv+txt40s=P-gk8AEHUUjnsaGOcyNbg@mail.gmail.com>
2014-03-31 19:17     ` Peter Maydell
2014-04-01  6:08       ` Gaurav Sharma

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=CAFEAcA-ANKm_Cu7fLdCuvE+cpRJkoQMAM93+TspQRsMGhZkkrQ@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=gauravs.2010@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /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).