XMM register usage in the kernel
kostikbel at gmail.com
Mon Mar 22 10:23:02 UTC 2010
apparently, my Core i7 930 does not support AES-NI. I read too much
about this thing before realizing that I do not have access to supported
CPU, so I had a time to prototype support for using XMM registers and,
in some degree, a coprocessor features, in the kernel mode for AMD64.
The i386 could be done in a similar manner, but would be less clean, it
The KPI consists of two functions, fpu_kern_enter() and fpu_kern_leave().
The pair should brace the region of code that intend to use coprocessor.
Caller shall provide the context save area, I expect that usually this
memory will be allocated as part of larger subsystem data structure.
fpu_kern_enter() allows the nesting, assuming fpu_kern_leave() is
called proper number of times to pop the context stack.
I deliberately ignored the issue of handling the coprocessor exceptions
in the kernel mode. My assumption is that this facility is for the
things like AES-NI or similar, where exceptions are not generated if
proper programming is ensured.
Prototyped patch is at
Example usage can be seen at
(note that example does not follow the guidelines above, usermode can
easily crash kernel module, but the goal was to give an example of KPI
Awaiting for feedback, thanks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-amd64/attachments/20100322/555fb83b/attachment.pgp
More information about the freebsd-amd64