Date: Sun, 22 Sep 2002 21:33:01 -0700 (PDT) From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 17953 for review Message-ID: <200209230433.g8N4X1c3009054@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=17953 Change 17953 by peter@peter_overcee on 2002/09/22 21:32:55 We have cpu_fxsr unconditionally as an arch feature. Affected files ... .. //depot/projects/hammer/sys/x86_64/include/md_var.h#6 edit .. //depot/projects/hammer/sys/x86_64/include/tss.h#2 edit .. //depot/projects/hammer/sys/x86_64/isa/npx.c#10 edit .. //depot/projects/hammer/sys/x86_64/x86_64/machdep.c#21 edit Differences ... ==== //depot/projects/hammer/sys/x86_64/include/md_var.h#6 (text+ko) ==== @@ -42,7 +42,6 @@ extern u_int cpu_feature; extern u_int cpu_high; extern u_int cpu_id; -extern u_int cpu_fxsr; extern char cpu_vendor[]; extern uint16_t *elan_mmcr; extern char kstack[]; ==== //depot/projects/hammer/sys/x86_64/include/tss.h#2 (text+ko) ==== ==== //depot/projects/hammer/sys/x86_64/isa/npx.c#10 (text+ko) ==== @@ -81,11 +81,8 @@ #define fldcw(addr) __asm("fldcw %0" : : "m" (*(addr))) #define fnclex() __asm("fnclex") #define fninit() __asm("fninit") -#define fnsave(addr) __asm __volatile("fnsave %0" : "=m" (*(addr))) #define fnstcw(addr) __asm __volatile("fnstcw %0" : "=m" (*(addr))) #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))) #define fxrstor(addr) __asm("fxrstor %0" : : "m" (*(addr))) #define fxsave(addr) __asm __volatile("fxsave %0" : "=m" (*(addr))) #define start_emulating() __asm("smsw %%ax; orb %0,%%al; lmsw %%ax" \ @@ -97,11 +94,8 @@ void fldcw(caddr_t addr); void fnclex(void); void fninit(void); -void fnsave(caddr_t addr); void fnstcw(caddr_t addr); void fnstsw(caddr_t addr); -void fp_divide_by_0(void); -void frstor(caddr_t addr); void fxsave(caddr_t addr); void fxrstor(caddr_t addr); void start_emulating(void); @@ -109,14 +103,8 @@ #endif /* __GNUC__ */ -#define GET_FPU_CW(thread) \ - (cpu_fxsr ? \ - (thread)->td_pcb->pcb_save.sv_xmm.sv_env.en_cw : \ - (thread)->td_pcb->pcb_save.sv_87.sv_env.en_cw) -#define GET_FPU_SW(thread) \ - (cpu_fxsr ? \ - (thread)->td_pcb->pcb_save.sv_xmm.sv_env.en_sw : \ - (thread)->td_pcb->pcb_save.sv_87.sv_env.en_sw) +#define GET_FPU_CW(thread) ((thread)->td_pcb->pcb_save.sv_xmm.sv_env.en_cw) +#define GET_FPU_SW(thread) ((thread)->td_pcb->pcb_save.sv_xmm.sv_env.en_sw) typedef u_char bool_t; @@ -237,8 +225,7 @@ npxsave(&dummy); stop_emulating(); /* XXX npxsave() doesn't actually initialize the fpu in the SSE case. */ - if (cpu_fxsr) - fninit(); + fninit(); fldcw(&control); start_emulating(); intr_restore(savecrit); @@ -278,10 +265,7 @@ npxformat() { - if (cpu_fxsr) - return (_MC_FPFMT_XMM); - else - return (_MC_FPFMT_387); + return (_MC_FPFMT_XMM); } /* @@ -636,13 +620,6 @@ s = intr_disable(); if (curthread == PCPU_GET(fpcurthread)) { fpusave(addr); - /* - * 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) - npxdrop(); intr_restore(s); return (_MC_FPOWNED_FPU); } else { @@ -677,10 +654,7 @@ union savefpu *addr; { - if (cpu_fxsr) - fxsave(addr); - else - fnsave(addr); + fxsave(addr); } static void @@ -688,10 +662,7 @@ union savefpu *addr; { - if (cpu_fxsr) - fxrstor(addr); - else - frstor(addr); + fxrstor(addr); } static device_method_t npx_methods[] = { ==== //depot/projects/hammer/sys/x86_64/x86_64/machdep.c#21 (text+ko) ==== @@ -1459,11 +1459,7 @@ fill_fpregs(struct thread *td, struct fpreg *fpregs) { - if (cpu_fxsr) - fill_fpregs_xmm(&td->td_pcb->pcb_save.sv_xmm, - (struct save87 *)fpregs); - else - bcopy(&td->td_pcb->pcb_save.sv_87, fpregs, sizeof *fpregs); + fill_fpregs_xmm(&td->td_pcb->pcb_save.sv_xmm, (struct save87 *)fpregs); return (0); } @@ -1471,11 +1467,7 @@ set_fpregs(struct thread *td, struct fpreg *fpregs) { - if (cpu_fxsr) - set_fpregs_xmm((struct save87 *)fpregs, - &td->td_pcb->pcb_save.sv_xmm); - else - bcopy(fpregs, &td->td_pcb->pcb_save.sv_87, sizeof *fpregs); + set_fpregs_xmm((struct save87 *)fpregs, &td->td_pcb->pcb_save.sv_xmm); return (0); } @@ -1567,8 +1559,7 @@ * npxgetregs()'s internals. */ addr = (union savefpu *)&mcp->mc_fpstate; - if (td == PCPU_GET(fpcurthread) && cpu_fxsr && - ((uintptr_t)(void *)addr & 0xF)) { + if (td == PCPU_GET(fpcurthread) && ((uintptr_t)(void *)addr & 0xF)) { do addr = (void *)((char *)addr + 4); while ((uintptr_t)(void *)addr & 0xF); @@ -1598,7 +1589,7 @@ mcp->mc_ownedfp == _MC_FPOWNED_PCB) { /* XXX align as above. */ addr = (union savefpu *)&mcp->mc_fpstate; - if (td == PCPU_GET(fpcurthread) && cpu_fxsr && + if (td == PCPU_GET(fpcurthread) && ((uintptr_t)(void *)addr & 0xF)) { do addr = (void *)((char *)addr + 4); @@ -1630,7 +1621,7 @@ npxdrop(); /* * XXX force a full drop of the npx. The above only drops it if we - * owned it. npxgetregs() has the same bug in the !cpu_fxsr case. + * owned it. * * XXX I don't much like npxgetregs()'s semantics of doing a full * drop. Dropping only to the pcb matches fnsave's behaviour. 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?200209230433.g8N4X1c3009054>