Page MenuHomeFreeBSD

x86: Add routines for querying XSAVE feature information
Needs ReviewPublic

Authored by bnovkov on Fri, Nov 1, 3:28 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 4, 4:12 PM
Unknown Object (File)
Mon, Nov 4, 8:27 AM
Unknown Object (File)
Sun, Nov 3, 9:57 AM
Unknown Object (File)
Fri, Nov 1, 8:44 PM
Subscribers

Details

Reviewers
br
kib
Summary

This patch adds several routines that track and expose information about various XSAVE-related features.
More specifically, it adds the ability to check whether a given XFEATURE is supported and which XSAVE extensions are supported.
Furthermore, it adds several routines for calculating the size and offsets within a save area given a XSAVE feature bitmap.

Test Plan

Tested by converting D46397 to use the newly added interfaces.
No issues were encountered while tracing.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

A quick remark regarding code placement - I couldn't decide where this code should reside so I ultimately placed it in cpu_machdep.c, but I'm not too happy about it.
I'd certainly like to hear your thoughts on where this should reside.

amd64/amd64/fpu.c seems to be the natural place for the new functions.
Despite named 'fpu', the file deals with the whole non-GPR part of the CPU state.

sys/x86/include/specialreg.h
381

Commit this chunk already

sys/x86/x86/cpu_machdep.c
1811

Does it ever make sense to call these functions if XSAVE(S) are not supported?
Would it be better to convert the checks into KASSERTs?

1817

'else' is not needed