pc64: AMD64 mandates SSE support, remove the check in fpuinit()
This commit is contained in:
parent
dcdb2bfb9a
commit
cd38d41356
1 changed files with 18 additions and 35 deletions
|
@ -30,18 +30,6 @@ extern void _fwait(void);
|
||||||
extern void _ldmxcsr(u32int);
|
extern void _ldmxcsr(u32int);
|
||||||
extern void _stts(void);
|
extern void _stts(void);
|
||||||
|
|
||||||
/*
|
|
||||||
* not used, AMD64 mandated SSE
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
fpx87save(FPsave*)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
static void
|
|
||||||
fpx87restore(FPsave*)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fpssesave(FPsave *s)
|
fpssesave(FPsave *s)
|
||||||
{
|
{
|
||||||
|
@ -261,34 +249,29 @@ mathinit(void)
|
||||||
void
|
void
|
||||||
fpuinit(void)
|
fpuinit(void)
|
||||||
{
|
{
|
||||||
uintptr cr4;
|
u64int cr4;
|
||||||
ulong regs[4];
|
ulong regs[4];
|
||||||
|
|
||||||
if((m->cpuiddx & (Sse|Fxsr)) == (Sse|Fxsr)){ /* have sse fp? */
|
cr4 = getcr4() | CR4Osfxsr|CR4Oxmmex;
|
||||||
cr4 = getcr4() | CR4Osfxsr|CR4Oxmmex;
|
putcr4(cr4);
|
||||||
|
fpsave = fpssesave;
|
||||||
|
fprestore = fpsserestore;
|
||||||
|
|
||||||
|
if((m->cpuidcx & (Xsave|Avx)) == (Xsave|Avx) && getconf("*noavx") == nil){
|
||||||
|
cr4 |= CR4Oxsave;
|
||||||
putcr4(cr4);
|
putcr4(cr4);
|
||||||
fpsave = fpssesave;
|
m->xcr0 = 7; /* x87, sse, avx */
|
||||||
fprestore = fpsserestore;
|
putxcr0(m->xcr0);
|
||||||
|
fpsave = fpxsave;
|
||||||
|
fprestore = fpxrestore;
|
||||||
|
|
||||||
if((m->cpuidcx & (Xsave|Avx)) == (Xsave|Avx) && getconf("*noavx") == nil){
|
cpuid(0xd, 1, regs);
|
||||||
cr4 |= CR4Oxsave;
|
if(regs[0] & Xsaveopt)
|
||||||
putcr4(cr4);
|
fpsave = fpxsaveopt;
|
||||||
m->xcr0 = 7; /* x87, sse, avx */
|
if(regs[0] & Xsaves){
|
||||||
putxcr0(m->xcr0);
|
fpsave = fpxsaves;
|
||||||
fpsave = fpxsave;
|
fprestore = fpxrestores;
|
||||||
fprestore = fpxrestore;
|
|
||||||
|
|
||||||
cpuid(0xd, 1, regs);
|
|
||||||
if(regs[0] & Xsaveopt)
|
|
||||||
fpsave = fpxsaveopt;
|
|
||||||
if(regs[0] & Xsaves){
|
|
||||||
fpsave = fpxsaves;
|
|
||||||
fprestore = fpxrestores;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
fpsave = fpx87save;
|
|
||||||
fprestore = fpx87restore;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue