Author: kib Date: Thu Sep 18 09:13:20 2014 New Revision: 271747 URL: http://svnweb.freebsd.org/changeset/base/271747
Log: - Use NULL instead of 0 for fpcurthread. - Note the quirk with the interrupt enabled state of the dna handler. - Use just panic() instead of printf() and panic(). Print tid instead of pid, the fpu state is per-thread. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/amd64/fpu.c Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Thu Sep 18 08:58:22 2014 (r271746) +++ head/sys/amd64/amd64/fpu.c Thu Sep 18 09:13:20 2014 (r271747) @@ -362,7 +362,7 @@ fpuexit(struct thread *td) stop_emulating(); fpusave(curpcb->pcb_save); start_emulating(); - PCPU_SET(fpcurthread, 0); + PCPU_SET(fpcurthread, NULL); } critical_exit(); } @@ -602,16 +602,21 @@ fputrap_sse(void) return (fpetable[(mxcsr & (~mxcsr >> 7)) & 0x3f]); } +static int err_count = 0; + /* - * Implement device not available (DNA) exception + * Device Not Available (DNA, #NM) exception handler. + * + * It would be better to switch FP context here (if curthread != + * fpcurthread) and not necessarily for every context switch, but it + * is too hard to access foreign pcb's. * - * It would be better to switch FP context here (if curthread != fpcurthread) - * and not necessarily for every context switch, but it is too hard to - * access foreign pcb's. + * The handler is entered with interrupts enabled, which allows the + * context switch to happen before critical enter() is executed, and + * causes restoration of FPU context on CPU other than that caused + * DNA. It is fine, since context switch started emulation on the + * current CPU as well. */ - -static int err_count = 0; - void fpudna(void) { @@ -625,11 +630,9 @@ fpudna(void) return; } if (PCPU_GET(fpcurthread) != NULL) { - printf("fpudna: fpcurthread = %p (%d), curthread = %p (%d)\n", - PCPU_GET(fpcurthread), - PCPU_GET(fpcurthread)->td_proc->p_pid, - curthread, curthread->td_proc->p_pid); - panic("fpudna"); + panic("fpudna: fpcurthread = %p (%d), curthread = %p (%d)\n", + PCPU_GET(fpcurthread), PCPU_GET(fpcurthread)->td_tid, + curthread, curthread->td_tid); } stop_emulating(); /* _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"