From 398ac55cb9184bf7385528537f71525c7debec31 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Sat, 20 Aug 2005 00:34:00 +0000 Subject: Check for and report the presense of SSE3. This has started to appear in AMD products with the arrival of the venice core. ok deraadt@ --- sys/arch/amd64/amd64/identcpu.c | 8 +++++++- sys/arch/amd64/amd64/locore.S | 5 ++++- sys/arch/amd64/include/cpu.h | 3 ++- sys/arch/amd64/include/specialreg.h | 4 +++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/sys/arch/amd64/amd64/identcpu.c b/sys/arch/amd64/amd64/identcpu.c index 9b1596646e8..e786ccc7eb6 100644 --- a/sys/arch/amd64/amd64/identcpu.c +++ b/sys/arch/amd64/amd64/identcpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: identcpu.c,v 1.5 2004/06/25 11:03:27 art Exp $ */ +/* $OpenBSD: identcpu.c,v 1.6 2005/08/20 00:33:59 jsg Exp $ */ /* $NetBSD: identcpu.c,v 1.1 2003/04/26 18:39:28 fvdl Exp $ */ /* @@ -91,6 +91,8 @@ const struct { { CPUID_LONG, "LONG" }, { CPUID_3DNOW2, "3DNOW2" }, { CPUID_3DNOW, "3DNOW" } +}, cpu_cpuid_ecxfeatures[] = { + { CPUIDECX_SSE3, "SSE3" } }; int @@ -156,6 +158,10 @@ identifycpu(struct cpu_info *ci) for (i = 0; i < max; i++) if (ci->ci_feature_flags & cpu_cpuid_features[i].bit) printf("%s%s", i? "," : "", cpu_cpuid_features[i].str); + max = sizeof(cpu_cpuid_ecxfeatures) / sizeof(cpu_cpuid_ecxfeatures[0]); + for (i = 0; i < max; i++) + if (cpu_ecxfeature & cpu_cpuid_ecxfeatures[i].bit) + printf(",%s", cpu_cpuid_ecxfeatures[i].str); max = sizeof(cpu_ecpuid_features) / sizeof(cpu_ecpuid_features[0]); for (i = 0; i < max; i++) if (ci->ci_feature_eflags & cpu_ecpuid_features[i].bit) diff --git a/sys/arch/amd64/amd64/locore.S b/sys/arch/amd64/amd64/locore.S index 2f9c36b63bc..c94d739ecea 100644 --- a/sys/arch/amd64/amd64/locore.S +++ b/sys/arch/amd64/amd64/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.20 2005/07/26 08:38:29 art Exp $ */ +/* $OpenBSD: locore.S,v 1.21 2005/08/20 00:33:59 jsg Exp $ */ /* $NetBSD: locore.S,v 1.13 2004/03/25 18:33:17 drochner Exp $ */ /* @@ -175,6 +175,7 @@ _C_LABEL(lapic_isr): .globl _C_LABEL(cpu_id),_C_LABEL(cpu_vendor), _C_LABEL(cpu_brand_id) .globl _C_LABEL(cpuid_level),_C_LABEL(cpu_feature) + .globl _C_LABEL(cpu_ecxfeature) .globl _C_LABEL(esym),_C_LABEL(boothowto),_C_LABEL(bootdev) .globl _C_LABEL(bootinfo), _C_LABEL(bootinfo_size), _C_LABEL(atdevbase) .globl _C_LABEL(proc0paddr),_C_LABEL(PTDpaddr) @@ -185,6 +186,7 @@ _C_LABEL(cpu): .long 0 # are we 386, 386sx, or 486, _C_LABEL(cpu_id): .long 0 # saved from `cpuid' instruction _C_LABEL(cpu_feature): .long 0 # feature flags from 'cpuid' # instruction +_C_LABEL(cpu_ecxfeature):.long 0 # extended feature flags from 'cpuid' _C_LABEL(cpuid_level): .long -1 # max. level accepted by 'cpuid' # instruction _C_LABEL(cpu_vendor): .space 16 # vendor string returned by `cpuid' @@ -310,6 +312,7 @@ bi_size_ok: movl $1,%eax cpuid movl %eax,RELOC(cpu_id) + movl %ecx,RELOC(cpu_ecxfeature) movl %edx,RELOC(cpu_feature) movl $0x80000001, %eax diff --git a/sys/arch/amd64/include/cpu.h b/sys/arch/amd64/include/cpu.h index 54c4c795f37..49bccdf4d9b 100644 --- a/sys/arch/amd64/include/cpu.h +++ b/sys/arch/amd64/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.12 2005/07/26 08:38:29 art Exp $ */ +/* $OpenBSD: cpu.h,v 1.13 2005/08/20 00:33:59 jsg Exp $ */ /* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */ /*- @@ -250,6 +250,7 @@ extern int biosbasemem; extern int biosextmem; extern int cpu; extern int cpu_feature; +extern int cpu_ecxfeature; extern int cpu_id; extern char cpu_vendor[]; extern int cpuid_level; diff --git a/sys/arch/amd64/include/specialreg.h b/sys/arch/amd64/include/specialreg.h index 89bf2b88495..486176a4663 100644 --- a/sys/arch/amd64/include/specialreg.h +++ b/sys/arch/amd64/include/specialreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: specialreg.h,v 1.2 2004/02/09 22:15:52 mickey Exp $ */ +/* $OpenBSD: specialreg.h,v 1.3 2005/08/20 00:33:59 jsg Exp $ */ /* $NetBSD: specialreg.h,v 1.1 2003/04/26 18:39:48 fvdl Exp $ */ /* $NetBSD: x86/specialreg.h,v 1.2 2003/04/25 21:54:30 fvdl Exp $ */ @@ -126,6 +126,8 @@ #define CPUID_IA64 0x40000000 /* IA-64 architecture */ #define CPUID_SBF 0x80000000 /* signal break on FERR */ +#define CPUIDECX_SSE3 0x00000001 /* streaming SIMD extensions #3 */ + /* * AMD/VIA processor specific flags. */ -- cgit v1.2.3