Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
commit message should likely contain why this is safe...
I'm guessing because the crypto stuff restores the context and/or doesn't stomp on it in the first place... but I honestly don't know.
No, the crypto stuff uses the FPU context, that's why fpu_kern_enter is needed. What this does is use FPU_KERN_NOCTX which runs the operations in a critical section to avoid having to use an allocated context to save FPU state in. Instead, with NOCTX fpu_kern_enter initializes the FPU/vector state to a clean initial state and lets the FPU run and then at fpu_kern_leave it disables the FPU discarding the post-operation state and leaves the critical section.
With the current approach, you don't use a critical section while doing the operation, but you are saving the post-op state to ctx for no real reason. Instead, the real side effect is that ctx just provides a place to save the FPU state if we do a context switch during the operation. But there's no compelling need to pass the FPU state from one operation to another.