XSAVE vs. XSAVEOPT in fpusave / fpu_kern_enter?

Konstantin Belousov kostikbel at gmail.com
Tue Aug 15 10:44:53 UTC 2017


On Mon, Aug 14, 2017 at 08:42:35PM +0000, Rang, Anton wrote:
> Hi,
>
> While glancing at fpu_kern_enter, I noticed that fpusave() uses the
> XSAVE instruction, but not XSAVEOPT. The instance in cpu_switch.S is
> patched if XSAVEOPT is available, but should we also be able to use
> XSAVEOPT in fpusave as well? I can't see any reason why not, but I'm
> not 100% sure that the save area is set up properly in all cases.

Yes, XSAVEOPT should be safe there.

I have a WIP changes (for a long time) which emulate ifuncs in kernel.
Then fpusave() becomes a function call through a pointer indirection,
and avoids conditional, which makes adding XSAVEOPT variant free.

But I postponed committing this change, and may postpone even more.
If our system linker/external toolchain support gain a new linker that
support ifunc, then it might be better to use real ifunc.


More information about the freebsd-amd64 mailing list