Index: sys/amd64/amd64/fpu.c =================================================================== --- sys/amd64/amd64/fpu.c +++ sys/amd64/amd64/fpu.c @@ -1148,8 +1148,9 @@ if (pcb->pcb_save == get_pcb_user_save_pcb(pcb)) { if ((pcb->pcb_flags & PCB_USERFPUINITDONE) != 0) { set_pcb_flags(pcb, PCB_FPUINITDONE); - clear_pcb_flags(pcb, PCB_KERNFPU); - } else + if ((pcb->pcb_flags & PCB_KERNFPU_THR) == 0) + clear_pcb_flags(pcb, PCB_KERNFPU); + } else if ((pcb->pcb_flags & PCB_KERNFPU_THR) == 0) clear_pcb_flags(pcb, PCB_FPUINITDONE | PCB_KERNFPU); } else { if ((ctx->flags & FPU_KERN_CTX_FPUINITDONE) != 0) @@ -1172,7 +1173,7 @@ ("mangled pcb_save")); KASSERT(PCB_USER_FPU(curpcb), ("recursive call")); - set_pcb_flags(curpcb, PCB_KERNFPU); + set_pcb_flags(curpcb, PCB_KERNFPU | PCB_KERNFPU_THR); return (0); } @@ -1182,7 +1183,7 @@ if ((curthread->td_pflags & TDP_KTHREAD) == 0) return (0); - return ((curpcb->pcb_flags & PCB_KERNFPU) != 0); + return ((curpcb->pcb_flags & PCB_KERNFPU_THR) != 0); } /* Index: sys/amd64/include/pcb.h =================================================================== --- sys/amd64/include/pcb.h +++ sys/amd64/include/pcb.h @@ -84,6 +84,7 @@ #define PCB_KERNFPU 0x04 /* kernel uses fpu */ #define PCB_FPUINITDONE 0x08 /* fpu state is initialized */ #define PCB_USERFPUINITDONE 0x10 /* fpu user state is initialized */ +#define PCB_KERNFPU_THR 0x20 #define PCB_32BIT 0x40 /* process has 32 bit context (segs etc) */ #define PCB_FPUNOSAVE 0x80 /* no save area for current FPU ctx */