Page MenuHomeFreeBSD

D62206.1796089258.diff
No OneTemporary

Authored By
Unknown
Size
674 B
Referenced Files
None
Subscribers
None

D62206.1796089258.diff

diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c
--- a/sys/amd64/amd64/fpu.c
+++ b/sys/amd64/amd64/fpu.c
@@ -820,8 +820,17 @@
{
if ((td->td_pflags & TDP_KTHREAD) != 0 || !PCB_USER_FPU(td->td_pcb)) {
- PCPU_SET(fpcurthread, NULL);
- fpu_disable();
+ /*
+ * CR0.TS is clear only while a thread owns the FPU, and the
+ * only possible owner here is the old thread.
+ */
+ if (PCPU_GET(fpcurthread) != NULL) {
+ PCPU_SET(fpcurthread, NULL);
+ fpu_disable();
+ } else {
+ KASSERT((rcr0() & CR0_TS) != 0,
+ ("%s: CR0.TS clear without FPU owner", __func__));
+ }
} else if (PCPU_GET(fpcurthread) != td) {
restore_fpu_curthread(td);
}

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 1, 1:40 AM (23 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42113037
Default Alt Text
D62206.1796089258.diff (674 B)

Event Timeline