Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/arch/i386/i386/locore.S,v rcsdiff: /ftp/cvs/cvsroot/src/sys/arch/i386/i386/locore.S,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.107 retrieving revision 1.109 diff -u -p -r1.107 -r1.109 --- src/sys/arch/i386/i386/locore.S 2013/10/23 20:18:50 1.107 +++ src/sys/arch/i386/i386/locore.S 2014/01/11 17:05:17 1.109 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.107 2013/10/23 20:18:50 drochner Exp $ */ +/* $NetBSD: locore.S,v 1.109 2014/01/11 17:05:17 christos Exp $ */ /* * Copyright-o-rama! @@ -129,7 +129,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.107 2013/10/23 20:18:50 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.109 2014/01/11 17:05:17 christos Exp $"); #include "opt_compat_oldboot.h" #include "opt_ddb.h" @@ -881,8 +881,9 @@ END(lgdt_finish) * * This is a trampoline function pushed onto the stack of a newly created * process in order to do some additional setup. The trampoline is entered by - * cpu_switch()ing to the process, so we abuse the callee-saved registers used - * by cpu_switch() to store the information about the stub to call. + * cpu_switchto()ing to the process, so we abuse the callee-saved + * registers used by cpu_switchto() to store the information about the + * stub to call. * NOTE: This function does not have a normal calling sequence! */ NENTRY(lwp_trampoline) @@ -1077,11 +1078,20 @@ ENTRY(cpu_switchto) call _C_LABEL(i386_tls_switch) addl $4,%esp #else /* !XEN */ - movl PCB_CR0(%ebx),%ecx + movl $IPL_HIGH,CPUVAR(ILEVEL) + movl PCB_CR0(%ebx),%ecx /* has CR0_TS clear */ movl %cr0,%edx + /* + * If our floating point registers are on a different CPU, + * set CR0_TS so we'll trap rather than reuse bogus state. + */ + cmpl CPUVAR(FPCURLWP),%edi + je 3f + orl $CR0_TS,%ecx + /* Reloading CR0 is very expensive - avoid if possible. */ - cmpl %edx,%ecx +3: cmpl %edx,%ecx je 4f movl %ecx,%cr0 #endif /* !XEN */