qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Rabin Vincent <rabin@rab.in>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] target-arm: add dump-guest-memory support
Date: Wed, 24 Dec 2014 17:12:09 +0000	[thread overview]
Message-ID: <CAFEAcA8Moisi2Vfn7h76qw3nU02-y-gsuJYff033U0K0LD1Xgw@mail.gmail.com> (raw)
In-Reply-To: <20141224165456.GA10393@dator>

On 24 December 2014 at 16:54, Rabin Vincent <rabin@rab.in> wrote:
> On Tue, Dec 23, 2014 at 11:45:00PM +0000, Peter Maydell wrote:
>> Assuming the answer is "still 64 bit core dump" you need
>> to do something here to sync the 32 bit TCG state into the
>> 64 bit xregs array. (KVM can take care of itself.)
>
> I have now tested this by triggering a dump while a 32-bit process is
> incrementing a register in a tight loop, and the following, which I
> lifted off the exception handling code, appears to work:
>
>     if (!is_a64(&cpu->env)) {
>         int i;
>
>         for (i = 0; i < 15; i++) {
>             prstatus.regs[i] = cpu->env.regs[i];
>         }
>     }

Yes, that looks OK, but can you factor it out to a function
in target-arm/, please? When we add support for 32-bit EL1
in 64-bit EL2/EL3 it'll need to get more complicated.

Also you need to use the read_cpsr() value for pstate.

>> Note that in fact ARM is never going to be TARGET_WORDS_BIGENDIAN,
>> even if the guest is big-endian, because the #define represents
>> the bus endianness, not whether the CPU happens to currently be
>> doing byte-swizzling. Do you need to key d_endian off the CPU's
>> current endianness setting? The current endianness of EL1?
>> Something else?
>
> IIUC we don't currently support anything other than little endian in
> system emulation?  Attempting to boot a BE ARMv7 vexpress kernel hits
> the unimplementation of setend pretty quickly, and I don't see any
> machine initializing the bswap_code to big endian.

We don't currently in emulation; there are patches on-list to
support it for KVM, though, which I expect we'll be merging
shortly.

(I really should resurrect that patchseries Paolo sent out to
add BE support, it was pretty close but I think needed a few
more tweaks.)

> According the the ELF specification for ARM, the choice between
> ELFDATA2LSB and ELFDATA2MSB "will be governed by the default data order
> in the execution environment".  Since we dump the full system memory I
> would interpret this to be the "lowest" execution environment.  So I
> guess for ARM this would mean setting big endian if (SCTLR.EE ||
> SCTLR.B) and for AArch64 if SCTLR_EL1.E0E is set?

I think AArch64 should be SCTLR_EL1.EE, shouldn't it?

What are the semantics of the dump if we support EL2/EL3?
Do we still just dump from the perspective of EL1? That's
probably the best approximation to useful for a user I guess.

-- PMM

      reply	other threads:[~2014-12-24 17:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-23 23:29 [Qemu-devel] [PATCH] target-arm: add dump-guest-memory support Rabin Vincent
2014-12-23 23:45 ` Peter Maydell
2014-12-24 16:54   ` Rabin Vincent
2014-12-24 17:12     ` Peter Maydell [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=CAFEAcA8Moisi2Vfn7h76qw3nU02-y-gsuJYff033U0K0LD1Xgw@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rabin@rab.in \
    /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).