pc64: assign fpsave/fprestore only once in fpuinit()
This commit is contained in:
parent
cd38d41356
commit
23b52bbf23
1 changed files with 10 additions and 9 deletions
|
@ -253,25 +253,26 @@ fpuinit(void)
|
||||||
ulong regs[4];
|
ulong regs[4];
|
||||||
|
|
||||||
cr4 = getcr4() | CR4Osfxsr|CR4Oxmmex;
|
cr4 = getcr4() | CR4Osfxsr|CR4Oxmmex;
|
||||||
putcr4(cr4);
|
|
||||||
fpsave = fpssesave;
|
|
||||||
fprestore = fpsserestore;
|
|
||||||
|
|
||||||
if((m->cpuidcx & (Xsave|Avx)) == (Xsave|Avx) && getconf("*noavx") == nil){
|
if((m->cpuidcx & (Xsave|Avx)) == (Xsave|Avx) && getconf("*noavx") == nil){
|
||||||
cr4 |= CR4Oxsave;
|
cr4 |= CR4Oxsave;
|
||||||
putcr4(cr4);
|
putcr4(cr4);
|
||||||
m->xcr0 = 7; /* x87, sse, avx */
|
m->xcr0 = 7; /* x87, sse, avx */
|
||||||
putxcr0(m->xcr0);
|
putxcr0(m->xcr0);
|
||||||
fpsave = fpxsave;
|
|
||||||
fprestore = fpxrestore;
|
|
||||||
|
|
||||||
cpuid(0xd, 1, regs);
|
cpuid(0xd, 1, regs);
|
||||||
if(regs[0] & Xsaveopt)
|
|
||||||
fpsave = fpxsaveopt;
|
|
||||||
if(regs[0] & Xsaves){
|
if(regs[0] & Xsaves){
|
||||||
fpsave = fpxsaves;
|
fpsave = fpxsaves;
|
||||||
fprestore = fpxrestores;
|
fprestore = fpxrestores;
|
||||||
|
} else {
|
||||||
|
if(regs[0] & Xsaveopt)
|
||||||
|
fpsave = fpxsaveopt;
|
||||||
|
else
|
||||||
|
fpsave = fpxsave;
|
||||||
|
fprestore = fpxrestore;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
putcr4(cr4);
|
||||||
|
fpsave = fpssesave;
|
||||||
|
fprestore = fpsserestore;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue