Index: sparc/genassym.cf =================================================================== RCS file: /cvsroot/src/sys/arch/sparc/sparc/genassym.cf,v retrieving revision 1.60 diff -p -r1.60 genassym.cf *** sparc/genassym.cf 3 Jan 2010 11:44:58 -0000 1.60 --- sparc/genassym.cf 6 Jan 2010 01:30:14 -0000 *************** define L_STAT offsetof(struct lwp, l_st *** 112,117 **** --- 112,118 ---- define L_WCHAN offsetof(struct lwp, l_wchan) define L_CPU offsetof(struct lwp, l_cpu) define L_PRIORITY offsetof(struct lwp, l_priority) + define L_FPSTATE offsetof(struct lwp, l_md.md_fpstate) define P_VMSPACE offsetof(struct proc, p_vmspace) define P_MD_SYSCALL offsetof(struct proc, p_md.md_syscall) define LSRUN LSRUN *************** define CPUINFO_IDLESPIN offsetof(struct *** 166,171 **** --- 167,173 ---- define CPUINFO_MTX_COUNT offsetof(struct cpu_info, ci_mtx_count) define CPUINFO_MTX_OLDSPL offsetof(struct cpu_info, ci_mtx_oldspl) define CPUINFO_IDEPTH offsetof(struct cpu_info, ci_idepth) + define CPUINFO_FPLWP offsetof(struct cpu_info, fplwp) # PTE bits and related information define PG_W PG_W Index: sparc/locore.s =================================================================== RCS file: /cvsroot/src/sys/arch/sparc/sparc/locore.s,v retrieving revision 1.254 diff -p -r1.254 locore.s *** sparc/locore.s 4 Jan 2010 04:06:57 -0000 1.254 --- sparc/locore.s 6 Jan 2010 01:30:14 -0000 *************** Lfp_storeq: *** 5921,5926 **** --- 5921,5954 ---- srl %o3, 3, %o3 ! (but first fix qsize) /* + * Entry point for savefpstate IPI's. We skip the IPI if the fplwp is not + * the same as this LWP. Since we zero cpuinfo.fplwp here, we call + * savefpstate() instead of inlining savefpstate() here, since we'd need to + * replicate the "special_fp_store" handling. + * + * %o0 = struct lwp * + */ + #ifdef MULTIPROCESSOR + ENTRY(ipi_savefpstate) + sethi %hi(CPUINFO_VA), %o1 + ld [%o1 + CPUINFO_FPLWP], %o2 + cmp %o2, %o0 + bne savefpstate + nop + + call savefpstate + ld [%o2 + L_FPSTATE], %i0 + + ! now zero cpuinfo.fplwp + sethi %hi(CPUINFO_VA), %o1 + st %g0, [%o1 + CPUINFO_FPLWP] + + 1: + retl + nop + #endif + + /* * The fsr store trapped. Do it again; this time it will not trap. * We could just have the trap handler return to the `st %fsr', but * if for some reason it *does* trap, that would lock us into a tight Index: sparc/machdep.c =================================================================== RCS file: /cvsroot/src/sys/arch/sparc/sparc/machdep.c,v retrieving revision 1.300 diff -p -r1.300 machdep.c *** sparc/machdep.c 3 Jan 2010 23:03:21 -0000 1.300 --- sparc/machdep.c 6 Jan 2010 01:30:14 -0000 *************** setregs(struct lwp *l, struct exec_packa *** 381,389 **** savefpstate(fs); #if defined(MULTIPROCESSOR) else ! XCALL1(savefpstate, fs, 1 << cpi->ci_cpuid); #endif - cpi->fplwp = NULL; } l->l_md.md_fpu = NULL; FPU_UNLOCK(s); --- 381,388 ---- savefpstate(fs); #if defined(MULTIPROCESSOR) else ! XCALL1(ipi_savefpstate, l, 1 << cpi->ci_cpuid); #endif } l->l_md.md_fpu = NULL; FPU_UNLOCK(s); Index: sparc/trap.c =================================================================== RCS file: /cvsroot/src/sys/arch/sparc/sparc/trap.c,v retrieving revision 1.179 diff -p -r1.179 trap.c *** sparc/trap.c 21 Nov 2009 04:16:52 -0000 1.179 --- sparc/trap.c 6 Jan 2010 01:30:14 -0000 *************** badtrap: *** 478,486 **** panic("FPU(%d): state for %p", cpi->ci_cpuid, l); #if defined(MULTIPROCESSOR) ! XCALL1(savefpstate, fs, 1 << cpi->ci_cpuid); #endif - cpi->fplwp = NULL; } loadfpstate(fs); --- 478,485 ---- panic("FPU(%d): state for %p", cpi->ci_cpuid, l); #if defined(MULTIPROCESSOR) ! XCALL1(ipi_savefpstate, l, 1 << cpi->ci_cpuid); #endif } loadfpstate(fs); Index: sparc/vm_machdep.c =================================================================== RCS file: /cvsroot/src/sys/arch/sparc/sparc/vm_machdep.c,v retrieving revision 1.101 diff -p -r1.101 vm_machdep.c *** sparc/vm_machdep.c 21 Nov 2009 04:16:52 -0000 1.101 --- sparc/vm_machdep.c 6 Jan 2010 01:30:14 -0000 *************** cpu_lwp_fork(struct lwp *l1, struct lwp *** 228,235 **** savefpstate(l1->l_md.md_fpstate); #if defined(MULTIPROCESSOR) else ! XCALL1(savefpstate, l1->l_md.md_fpstate, ! 1 << cpi->ci_cpuid); #endif } memcpy(l2->l_md.md_fpstate, l1->l_md.md_fpstate, --- 228,234 ---- savefpstate(l1->l_md.md_fpstate); #if defined(MULTIPROCESSOR) else ! XCALL1(ipi_savefpstate, l1, 1 << cpi->ci_cpuid); #endif } memcpy(l2->l_md.md_fpstate, l1->l_md.md_fpstate, *************** cpu_lwp_free(struct lwp *l, int proc) *** 306,312 **** savefpstate(fs); #if defined(MULTIPROCESSOR) else ! XCALL1(savefpstate, fs, 1 << cpi->ci_cpuid); #endif cpi->fplwp = NULL; } --- 305,311 ---- savefpstate(fs); #if defined(MULTIPROCESSOR) else ! XCALL1(ipi_savefpstate, l, 1 << cpi->ci_cpuid); #endif cpi->fplwp = NULL; }