From: Peter Maydell <peter.maydell@linaro.org>
To: Sebastian Huber <sebastian.huber@embedded-brains.de>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: Are floating-point exceptions usable on AArch64?
Date: Wed, 4 Sep 2024 13:18:05 +0100 [thread overview]
Message-ID: <CAFEAcA9dno-ZA6cSMr556-biNphdFHBhBXRZsavR43XajnTH2Q@mail.gmail.com> (raw)
In-Reply-To: <1832886563.20496.1725444713946.JavaMail.zimbra@embedded-brains.de>
On Wed, 4 Sept 2024 at 11:32, Sebastian Huber
<sebastian.huber@embedded-brains.de> wrote:
> I tried to provoke a division-by-zero exception on AArch64 using:
>
> uint64_t value;
> __asm__ volatile (
> "mrs %0, FPCR\n"
> "orr %0, %0, 0x200\n"
> "msr FPCR, %0" : "=&r" ( value ) : : "memory"
> );
> volatile double x = 0x0;
> volatile double y = 0x0;
> x /= y;
>
> When I look with the debugger at $fpcr it still says 0x0
> after the msr. Are floating-point exceptions usable on
> AArch64 in general?
Floating point exceptions, in the sense of "when the
exception condition happens the cumulative exception bit
in the FPSR is set", work. What you're trying to use here is what
the architecture calls "trapped exception handling", where
you set the DZE etc bits in the FPCR to get a CPU exception
instead of it updating the FPSR bit. Those are architecturally
optional, and QEMU's CPU implementation doesn't implement them.
(Nor do most real hardware implementations AFAIK.)
thanks
-- PMM
next prev parent reply other threads:[~2024-09-04 12:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-04 10:11 Are floating-point exceptions usable on AArch64? Sebastian Huber
2024-09-04 12:18 ` Peter Maydell [this message]
2024-09-26 13:52 ` Peter Maydell
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=CAFEAcA9dno-ZA6cSMr556-biNphdFHBhBXRZsavR43XajnTH2Q@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=sebastian.huber@embedded-brains.de \
/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).