On Mon, Oct 06, 2014 at 02:18:19PM -0700, David Daney wrote:
Userspace should play no part in this; requiring userspace to help
make special accomodations for fpu emulation largely defeats the
purpose of fpu emulation.
That is certainly one way of looking at it. Really it is opinion,
rather than fact though.
It's an opinion, yes, but it has substantial reason behind it.
GLibc is full of code (see ld.so) that in earlier incantations of
Unix/Linux was in kernel space, and was moved to userspace. Given
that there is a partitioning of code between kernel space and
userspace, I think it not totally unreasonable to consider doing
some of this in userspace.
Even on systems with hardware FPU, the architecture specification
allows for/requires emulation of certain cases (denormals, etc.) So
it is already a requirement that userspace cooperate by always
having free space below $SP for use by the kernel. So the current
situation is that userspace is providing services for the kernel FPU
emulator.
My suggestion is to change the nature of the way these services are
provided by the userspace program.
But this isn't setup by the userspace program. It's setup by the
kernel on program entry. Despite that, though, I think it's an
unnecessary (and undocumented!) constraint; the fact that it requires
the stack to be executable makes it even more harmful and
inappropriate.