Subject: PR/35302: Wrong Intel CPUs features display
To: NetBSD amd64 <port-amd64@NetBSD.org>
From: Nicolas Joly <njoly@pasteur.fr>
List: port-amd64
Date: 03/06/2007 15:37:06
--tKW2IUtsqtDRztdT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi,
I was asked, offline, if i can commit my changes to fix Intel CPUs
features display (PR/35302).
Here is an updated version for -current, as the one in the PR does not
apply cleanly anymore.
Any objection ?
--
Nicolas Joly
Biological Software and Databanks.
Institut Pasteur, Paris.
--tKW2IUtsqtDRztdT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="netbsd-intelcpufeats.diff"
Index: sys/arch/amd64/amd64/identcpu.c
===================================================================
RCS file: /cvsroot/src/sys/arch/amd64/amd64/identcpu.c,v
retrieving revision 1.10
diff -u -r1.10 identcpu.c
--- sys/arch/amd64/amd64/identcpu.c 3 Mar 2007 10:55:34 -0000 1.10
+++ sys/arch/amd64/amd64/identcpu.c 6 Mar 2007 14:23:07 -0000
@@ -60,6 +60,7 @@
char buf[512];
u_int32_t brand[12];
int vendor;
+ const char *feature_str[3];
CPUID(1, ci->ci_signature, val, dummy, ci->ci_feature_flags);
CPUID(0x80000001, dummy, dummy, dummy, val);
@@ -90,19 +91,29 @@
((ci->ci_tsc_freq + 4999) / 10000) % 100);
printf("\n");
+ if (vendor == CPUVENDOR_INTEL) {
+ feature_str[0] = CPUID_FLAGS1;
+ feature_str[1] = CPUID_FLAGS2;
+ feature_str[2] = CPUID_FLAGS3;
+ } else {
+ feature_str[0] = CPUID_FLAGS1;
+ feature_str[1] = CPUID_EXT_FLAGS2;
+ feature_str[2] = CPUID_EXT_FLAGS3;
+ }
+
if ((ci->ci_feature_flags & CPUID_MASK1) != 0) {
bitmask_snprintf(ci->ci_feature_flags,
- CPUID_FLAGS1, buf, sizeof(buf));
+ feature_str[0], buf, sizeof(buf));
printf("%s: features: %s\n", ci->ci_dev->dv_xname, buf);
}
if ((ci->ci_feature_flags & CPUID_MASK2) != 0) {
bitmask_snprintf(ci->ci_feature_flags,
- CPUID_EXT_FLAGS2, buf, sizeof(buf));
+ feature_str[1], buf, sizeof(buf));
printf("%s: features: %s\n", ci->ci_dev->dv_xname, buf);
}
if ((ci->ci_feature_flags & CPUID_MASK3) != 0) {
bitmask_snprintf(ci->ci_feature_flags,
- CPUID_EXT_FLAGS3, buf, sizeof(buf));
+ feature_str[2], buf, sizeof(buf));
printf("%s: features: %s\n", ci->ci_dev->dv_xname, buf);
}
--tKW2IUtsqtDRztdT--