From: Peter Maydell <peter.maydell@linaro.org>
To: Martin Schroeder <mkschreder.uk@googlemail.com>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Simulating a composite machine
Date: Tue, 21 Aug 2018 09:57:55 +0100 [thread overview]
Message-ID: <CAFEAcA-9Q1Lr0PV48SNYG8hHTShcur_i-d+9u7P2ds3VTgxvfg@mail.gmail.com> (raw)
In-Reply-To: <CAGmj6qsWJq3cXheRpftnK2c9yCFCGDwN=Y9Y=m=QLBq+dTokAA@mail.gmail.com>
On 20 August 2018 at 19:29, Martin Schroeder
<mkschreder.uk@googlemail.com> wrote:
> Ok so FPU support is not there. What would it take for me to add it? I
> would very much like to add it if I get some guidance as to what needs
> to be done and where I can find information on how to do it. I see
> there is some code in fpu/softfloat.c but I guess it is not enough?
As I say, it's mostly the exception handling parts (and also some
things like M profile having memory mapped registers for the FPU
ID registers). The instructions themselves are the same as the
A-profile FPU.
My summary breakdown of this task looks like:
* check which instructions we need to enable and which parts
of the current FP implementation are A/R specific and need
"not if M" conditionals
(this is going to involve some comparison-of-specifications
between the M-profile architecture spec manual and the A-profile
one. The answer is probably going to wind up being "the
A-profile-style FPU status and control register accesses
need to be disabled", but there might be more. You can assume
that the actual behaviour of each instruction is the same, though.)
* implement the status and ID registers that M profile wants
(mostly wiring up register accessors in hw/intc/armv7m_nvic.c
to existing CPU state fields, I think)
* exception model changes for FP (new exception frame layout, etc)
-- this is all code in target/arm/helper.c which now needs to
handle the possibility of an FPU. The pseudocode in the ARMv7M
and v8M manuals will help in identifying where changes need
to be made.
* make sure co-processor enable/disable is wired up right
(the coprocessor access is handled via a memory-mapped register)
* implement lazy saving of FP registers (complicated; when the
CPU status registers indicate that lazy-state-preservation is
in effect, we need to arrange that attempting to execute an
FP insn causes us to first stop and save the FPU state to the
stack, and then do the instruction. The best way to do this is
going to be to add a TB flag for "lazy state preservation required",
and if that flag is set then when we encounter an FP insn we
generate code for "raise a lazy-stacking exception". We can
then deal with the exception by "do the lazy-stacking, then
resume execution".
* turn this on for Cortex-M4, Cortex-M33 and test
thanks
-- PMM
prev parent reply other threads:[~2018-08-21 9:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-19 12:54 [Qemu-devel] Simulating a composite machine Martin Schroeder
2018-08-19 13:45 ` Peter Maydell
[not found] ` <CAGmj6qtJuootGneBjcz8aCRsBXBU+GN2nhERc+76un_CiBcDZQ@mail.gmail.com>
[not found] ` <CAFEAcA8wp=_MzzrT0G70n1eHbbt8FXf2upZB0cyBmhK3Pv+Y9w@mail.gmail.com>
2018-08-20 18:29 ` Martin Schroeder
2018-08-20 21:02 ` Martin Schroeder
2018-08-21 8:57 ` 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=CAFEAcA-9Q1Lr0PV48SNYG8hHTShcur_i-d+9u7P2ds3VTgxvfg@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=mkschreder.uk@googlemail.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).