Date: Fri, 20 Sep 2002 20:15:58 -0700 (PDT) From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 17816 for review Message-ID: <200209210315.g8L3FwHq005144@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=17816 Change 17816 by peter@peter_daintree on 2002/09/20 20:15:22 continue decruftification. CPU_ENABLE_SSE is on. It is an architectural feature. We should panic if it isn't present. Affected files ... .. //depot/projects/hammer/sys/x86_64/isa/npx.c#5 edit .. //depot/projects/hammer/sys/x86_64/x86_64/machdep.c#7 edit Differences ... ==== //depot/projects/hammer/sys/x86_64/isa/npx.c#5 (text+ko) ==== @@ -74,13 +74,6 @@ #include <isa/isavar.h> #endif -#if !defined(CPU_ENABLE_SSE) && defined(I686_CPU) -#define CPU_ENABLE_SSE -#endif -#if defined(CPU_DISABLE_SSE) -#undef CPU_ENABLE_SSE -#endif - /* * 387 and 287 Numeric Coprocessor Extension (NPX) Driver. */ @@ -101,10 +94,8 @@ #define fnstsw(addr) __asm __volatile("fnstsw %0" : "=m" (*(addr))) #define fp_divide_by_0() __asm("fldz; fld1; fdiv %st,%st(1); fnop") #define frstor(addr) __asm("frstor %0" : : "m" (*(addr))) -#ifdef CPU_ENABLE_SSE #define fxrstor(addr) __asm("fxrstor %0" : : "m" (*(addr))) #define fxsave(addr) __asm __volatile("fxsave %0" : "=m" (*(addr))) -#endif #define start_emulating() __asm("smsw %%ax; orb %0,%%al; lmsw %%ax" \ : : "n" (CR0_TS) : "ax") #define stop_emulating() __asm("clts") @@ -119,16 +110,13 @@ void fnstsw(caddr_t addr); void fp_divide_by_0(void); void frstor(caddr_t addr); -#ifdef CPU_ENABLE_SSE void fxsave(caddr_t addr); void fxrstor(caddr_t addr); -#endif void start_emulating(void); void stop_emulating(void); #endif /* __GNUC__ */ -#ifdef CPU_ENABLE_SSE #define GET_FPU_CW(thread) \ (cpu_fxsr ? \ (thread)->td_pcb->pcb_save.sv_xmm.sv_env.en_cw : \ @@ -137,12 +125,6 @@ (cpu_fxsr ? \ (thread)->td_pcb->pcb_save.sv_xmm.sv_env.en_sw : \ (thread)->td_pcb->pcb_save.sv_87.sv_env.en_sw) -#else /* CPU_ENABLE_SSE */ -#define GET_FPU_CW(thread) \ - (thread->td_pcb->pcb_save.sv_87.sv_env.en_cw) -#define GET_FPU_SW(thread) \ - (thread->td_pcb->pcb_save.sv_87.sv_env.en_sw) -#endif /* CPU_ENABLE_SSE */ typedef u_char bool_t; @@ -272,11 +254,9 @@ savecrit = intr_disable(); npxsave(&dummy); stop_emulating(); -#ifdef CPU_ENABLE_SSE /* XXX npxsave() doesn't actually initialize the fpu in the SSE case. */ if (cpu_fxsr) fninit(); -#endif fldcw(&control); start_emulating(); intr_restore(savecrit); @@ -316,11 +296,10 @@ npxformat() { -#ifdef CPU_ENABLE_SSE if (cpu_fxsr) return (_MC_FPFMT_XMM); -#endif - return (_MC_FPFMT_387); + else + return (_MC_FPFMT_387); } /* @@ -680,14 +659,12 @@ s = intr_disable(); if (curthread == PCPU_GET(fpcurthread)) { fpusave(addr); -#ifdef CPU_ENABLE_SSE + /* + * fnsave initializes the FPU and destroys whatever + * context it contains. Make sure the FPU owner + * starts with a clean state next time. + */ if (!cpu_fxsr) -#endif - /* - * fnsave initializes the FPU and destroys whatever - * context it contains. Make sure the FPU owner - * starts with a clean state next time. - */ npxdrop(); intr_restore(s); return (_MC_FPOWNED_FPU); @@ -723,11 +700,9 @@ union savefpu *addr; { -#ifdef CPU_ENABLE_SSE if (cpu_fxsr) fxsave(addr); else -#endif fnsave(addr); } @@ -736,11 +711,9 @@ union savefpu *addr; { -#ifdef CPU_ENABLE_SSE if (cpu_fxsr) fxrstor(addr); else -#endif frstor(addr); } ==== //depot/projects/hammer/sys/x86_64/x86_64/machdep.c#7 (text+ko) ==== @@ -129,21 +129,12 @@ #define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) #define EFL_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) -#if !defined(CPU_ENABLE_SSE) && defined(I686_CPU) -#define CPU_ENABLE_SSE -#endif -#if defined(CPU_DISABLE_SSE) -#undef CPU_ENABLE_SSE -#endif - static void cpu_startup(void *); static void fpstate_drop(struct thread *td); static void get_fpcontext(struct thread *td, mcontext_t *mcp); static int set_fpcontext(struct thread *td, const mcontext_t *mcp); -#ifdef CPU_ENABLE_SSE static void set_fpregs_xmm(struct save87 *, struct savexmm *); static void fill_fpregs_xmm(struct savexmm *, struct save87 *); -#endif /* CPU_ENABLE_SSE */ SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL) int _udatasel, _ucodesel; @@ -1574,7 +1565,6 @@ return (0); } -#ifdef CPU_ENABLE_SSE static void fill_fpregs_xmm(sv_xmm, sv_87) struct savexmm *sv_xmm; @@ -1624,33 +1614,28 @@ for (i = 0; i < 8; ++i) sv_xmm->sv_fp[i].fp_acc = sv_87->sv_ac[i]; } -#endif /* CPU_ENABLE_SSE */ int fill_fpregs(struct thread *td, struct fpreg *fpregs) { -#ifdef CPU_ENABLE_SSE - if (cpu_fxsr) { + + if (cpu_fxsr) fill_fpregs_xmm(&td->td_pcb->pcb_save.sv_xmm, (struct save87 *)fpregs); - return (0); - } -#endif /* CPU_ENABLE_SSE */ - bcopy(&td->td_pcb->pcb_save.sv_87, fpregs, sizeof *fpregs); + else + bcopy(&td->td_pcb->pcb_save.sv_87, fpregs, sizeof *fpregs); return (0); } int set_fpregs(struct thread *td, struct fpreg *fpregs) { -#ifdef CPU_ENABLE_SSE - if (cpu_fxsr) { + + if (cpu_fxsr) set_fpregs_xmm((struct save87 *)fpregs, &td->td_pcb->pcb_save.sv_xmm); - return (0); - } -#endif /* CPU_ENABLE_SSE */ - bcopy(fpregs, &td->td_pcb->pcb_save.sv_87, sizeof *fpregs); + else + bcopy(fpregs, &td->td_pcb->pcb_save.sv_87, sizeof *fpregs); return (0); } @@ -1747,10 +1732,7 @@ * npxgetregs()'s internals. */ addr = (union savefpu *)&mcp->mc_fpstate; - if (td == PCPU_GET(fpcurthread) && -#ifdef CPU_ENABLE_SSE - cpu_fxsr && -#endif + if (td == PCPU_GET(fpcurthread) && cpu_fxsr && ((uintptr_t)(void *)addr & 0xF)) { do addr = (void *)((char *)addr + 4); @@ -1782,10 +1764,7 @@ mcp->mc_ownedfp == _MC_FPOWNED_PCB) { /* XXX align as above. */ addr = (union savefpu *)&mcp->mc_fpstate; - if (td == PCPU_GET(fpcurthread) && -#ifdef CPU_ENABLE_SSE - cpu_fxsr && -#endif + if (td == PCPU_GET(fpcurthread) && cpu_fxsr && ((uintptr_t)(void *)addr & 0xF)) { do addr = (void *)((char *)addr + 4); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209210315.g8L3FwHq005144>