qemu-devel
[Top][All Lists]
Advanced

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

Re: Are floating-point exceptions usable on AArch64?


From: Peter Maydell
Subject: Re: Are floating-point exceptions usable on AArch64?
Date: Wed, 4 Sep 2024 13:18:05 +0100

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



reply via email to

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