summaryrefslogtreecommitdiff
path: root/sys/arch/amd64
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2018-05-26 23:09:40 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2018-05-26 23:09:40 +0000
commitf35c464a8ba1431cf1ee63f28e655cfad95eb984 (patch)
tree9df7b3a61f33242f347f4579c02e126a4c5577d3 /sys/arch/amd64
parentdfb63d0e95ecc82db0289e6611837c1b2485c4a5 (diff)
Only set fpu_save_len once and assert if it's too big or would differ
between CPUs ok kettenis@ mlarkin@
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r--sys/arch/amd64/amd64/cpu.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/arch/amd64/amd64/cpu.c b/sys/arch/amd64/amd64/cpu.c
index 45178186f8f..00bec4839ed 100644
--- a/sys/arch/amd64/amd64/cpu.c
+++ b/sys/arch/amd64/amd64/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.119 2018/05/26 18:49:28 guenther Exp $ */
+/* $OpenBSD: cpu.c,v 1.120 2018/05/26 23:09:39 guenther Exp $ */
/* $NetBSD: cpu.c,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */
/*-
@@ -534,7 +534,12 @@ cpu_init(struct cpu_info *ci)
xsave_mask |= XCR0_AVX;
xsetbv(0, xsave_mask);
CPUID_LEAF(0xd, 0, eax, ebx, ecx, edx);
- fpu_save_len = ebx;
+ if (CPU_IS_PRIMARY(ci)) {
+ fpu_save_len = ebx;
+ KASSERT(fpu_save_len <= sizeof(struct savefpu));
+ } else {
+ KASSERT(ebx == fpu_save_len);
+ }
}
#if NVMM > 0