summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2020-12-06 21:44:26 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2020-12-06 21:44:26 +0100
commitcd38d4135633fd2dd9ce544aa3c2c86cf5078f8d (patch)
treed79b8f89d148b4a4bed1b4310d5318b0beffeb2e
parentdcdb2bfb9ab915b9f18c36dc951ca421d97496a2 (diff)
downloadplan9front-cd38d4135633fd2dd9ce544aa3c2c86cf5078f8d.tar.xz
pc64: AMD64 mandates SSE support, remove the check in fpuinit()
-rw-r--r--sys/src/9/pc64/fpu.c53
1 files changed, 18 insertions, 35 deletions
diff --git a/sys/src/9/pc64/fpu.c b/sys/src/9/pc64/fpu.c
index 924a5752f..2b9a377b7 100644
--- a/sys/src/9/pc64/fpu.c
+++ b/sys/src/9/pc64/fpu.c
@@ -30,18 +30,6 @@ extern void _fwait(void);
extern void _ldmxcsr(u32int);
extern void _stts(void);
-/*
- * not used, AMD64 mandated SSE
- */
-static void
-fpx87save(FPsave*)
-{
-}
-static void
-fpx87restore(FPsave*)
-{
-}
-
static void
fpssesave(FPsave *s)
{
@@ -261,34 +249,29 @@ mathinit(void)
void
fpuinit(void)
{
- uintptr cr4;
+ u64int cr4;
ulong regs[4];
- if((m->cpuiddx & (Sse|Fxsr)) == (Sse|Fxsr)){ /* have sse fp? */
- cr4 = getcr4() | CR4Osfxsr|CR4Oxmmex;
- putcr4(cr4);
- fpsave = fpssesave;
- fprestore = fpsserestore;
+ cr4 = getcr4() | CR4Osfxsr|CR4Oxmmex;
+ putcr4(cr4);
+ fpsave = fpssesave;
+ fprestore = fpsserestore;
- if((m->cpuidcx & (Xsave|Avx)) == (Xsave|Avx) && getconf("*noavx") == nil){
- cr4 |= CR4Oxsave;
- putcr4(cr4);
- m->xcr0 = 7; /* x87, sse, avx */
- putxcr0(m->xcr0);
- fpsave = fpxsave;
- fprestore = fpxrestore;
+ if((m->cpuidcx & (Xsave|Avx)) == (Xsave|Avx) && getconf("*noavx") == nil){
+ cr4 |= CR4Oxsave;
+ putcr4(cr4);
+ m->xcr0 = 7; /* x87, sse, avx */
+ putxcr0(m->xcr0);
+ fpsave = fpxsave;
+ fprestore = fpxrestore;
- cpuid(0xd, 1, regs);
- if(regs[0] & Xsaveopt)
- fpsave = fpxsaveopt;
- if(regs[0] & Xsaves){
- fpsave = fpxsaves;
- fprestore = fpxrestores;
- }
+ cpuid(0xd, 1, regs);
+ if(regs[0] & Xsaveopt)
+ fpsave = fpxsaveopt;
+ if(regs[0] & Xsaves){
+ fpsave = fpxsaves;
+ fprestore = fpxrestores;
}
- } else {
- fpsave = fpx87save;
- fprestore = fpx87restore;
}
}