Port-arm archive

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

Why sysarch(ARM_VFP_FPSCR) only allows changing the rounding mode?



Hi,

I wonder why sysarch(ARM_VFP_FPSCR) only allows changing the rounding
mode, but not, for example, the flush to zero mode and the default NaN
mode?
(http://nxr.netbsd.org/source/xref/src/sys/arch/arm/arm32/sys_machdep.c#arm32_vfp_fpscr)

A little background: I was working on enabling VFP support for Go
(golang.org) on netbsd/arm. As Go formally requires correct handling of
subnormal floating point numbers, both Go runtime and Go compiler need
to clear the flush-to-zero bit of the FPSCR. On most other systems (Linux,
Darwin), fpscr is writable from the user space, however NetBSD forbids the
user space from changing that part of the fpscr.

I wonder why we insist on using flush-to-zero mode for VFP? That is
unfortunate as it means Go programs could only use software floating point
to be conforming to the language specification.

Lifting the restriction is easy, for example, the attached patch allows the
DN and FZ bits to be changed via sysarch(ARM_VFP_FPSCR). I don't think there
is any security implication in allowing this.

PS: it seems my last mail to the list got dropped somewhere,
apologies if you received duplicated mail about this topic.

Best regards,
minux

Attachment: fpscr.patch
Description: Binary data



Home | Main Index | Thread Index | Old Index