Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Reduce the difference between i386 and amd64 procfs...
details: https://anonhg.NetBSD.org/src/rev/69f90aa310a1
branches: trunk
changeset: 750923:69f90aa310a1
user: rmind <rmind%NetBSD.org@localhost>
date: Mon Jan 18 22:31:14 2010 +0000
description:
Reduce the difference between i386 and amd64 procfs MD code.
Prepare for the merge, no functional changes intended.
diffstat:
sys/arch/amd64/amd64/procfs_machdep.c | 82 ++++++++++++-----------
sys/arch/i386/i386/procfs_machdep.c | 114 +++++++++++++++++-----------------
2 files changed, 99 insertions(+), 97 deletions(-)
diffs (truncated from 383 to 300 lines):
diff -r ddc4ca8ef65f -r 69f90aa310a1 sys/arch/amd64/amd64/procfs_machdep.c
--- a/sys/arch/amd64/amd64/procfs_machdep.c Mon Jan 18 21:55:40 2010 +0000
+++ b/sys/arch/amd64/amd64/procfs_machdep.c Mon Jan 18 22:31:14 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: procfs_machdep.c,v 1.13 2010/01/18 21:55:40 njoly Exp $ */
+/* $NetBSD: procfs_machdep.c,v 1.14 2010/01/18 22:31:14 rmind Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.13 2010/01/18 21:55:40 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.14 2010/01/18 22:31:14 rmind Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -56,17 +56,16 @@
#include <machine/reg.h>
#include <machine/specialreg.h>
-extern int i386_fpu_present, i386_fpu_exception, i386_fpu_fdivbug;
-extern char cpu_model[];
-extern int cpu_class;
+extern int i386_fpu_present, i386_fpu_exception, i386_fpu_fdivbug;
+extern char cpu_model[];
-static const char * const i386_features[] = {
+static const char * const x86_features[] = {
/* Intel-defined */
"fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
"cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov",
"pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx",
"fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", NULL,
-
+
/* AMD-defined */
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL,
@@ -105,7 +104,7 @@
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
};
-static int procfs_getonecpu(int, struct cpu_info *, char *, int *);
+static int procfs_getonecpu(int, struct cpu_info *, char *, int *);
/*
* Linux-style /proc/cpuinfo.
@@ -134,7 +133,7 @@
*len += used + 1;
used = --total;
if (used == 0)
- break;
+ break;
} else {
*len += used;
break;
@@ -150,11 +149,10 @@
char featurebuf[256], *p;
p = featurebuf;
- left = sizeof featurebuf;
+ left = sizeof(featurebuf);
for (i = 0; i < 32; i++) {
- if ((ci->ci_feature_flags & (1 << i)) &&
- (i386_features[i] != NULL)) {
- l = snprintf(p, left, "%s ", i386_features[i]);
+ if ((ci->ci_feature_flags & (1 << i)) && x86_features[i]) {
+ l = snprintf(p, left, "%s ", x86_features[i]);
left -= l;
p += l;
if (left <= 0)
@@ -165,20 +163,18 @@
p = bf;
left = *len;
l = snprintf(p, left,
- "processor\t: %d\n"
- "vendor_id\t: %s\n"
- "cpu family\t: %d\n"
- "model\t\t: %d\n"
- "model name\t: %s\n"
- "stepping\t: ",
- xcpu,
- (char *)ci->ci_vendor,
- cpuid_level >= 0 ?
- ((ci->ci_signature >> 8) & 15) : cpu_class + 3,
- cpuid_level >= 0 ?
- ((ci->ci_signature >> 4) & 15) : 0,
- cpu_brand_string
- );
+ "processor\t: %d\n"
+ "vendor_id\t: %s\n"
+ "cpu family\t: %d\n"
+ "model\t\t: %d\n"
+ "model name\t: %s\n"
+ "stepping\t: ",
+ xcpu,
+ (char *)ci->ci_vendor,
+ cpuid_level >= 0 ? ((ci->ci_signature >> 8) & 15) : cpu_class + 3,
+ cpuid_level >= 0 ? ((ci->ci_signature >> 4) & 15) : 0,
+ cpu_brand_string
+ );
left -= l;
p += l;
@@ -195,7 +191,6 @@
if (left <= 0)
return 0;
-
if (ci->ci_data.cpu_cc_freq != 0) {
uint64_t freq, fraq;
@@ -212,18 +207,25 @@
return 0;
l = snprintf(p, left,
- "fdiv_bug\t: %s\n"
- "fpu\t\t: %s\n"
- "fpu_exception\t: %s\n"
- "cpuid level\t: %d\n"
- "wp\t\t: %s\n"
- "flags\t\t: %s\n",
- "no", /* XXX */
- "yes", /* XXX */
- "yes", /* XXX */
- cpuid_level,
- (rcr0() & CR0_WP) ? "yes" : "no",
- featurebuf);
+ "fdiv_bug\t: %s\n"
+ "fpu\t\t: %s\n"
+ "fpu_exception\t: %s\n"
+ "cpuid level\t: %d\n"
+ "wp\t\t: %s\n"
+ "flags\t\t: %s\n",
+#ifdef __x86_64__
+ "no", /* XXX */
+ "yes", /* XXX */
+ "yes", /* XXX */
+#else
+ i386_fpu_fdivbug ? "yes" : "no",
+ i386_fpu_present ? "yes" : "no",
+ i386_fpu_exception ? "yes" : "no",
+#endif
+ cpuid_level,
+ (rcr0() & CR0_WP) ? "yes" : "no",
+ featurebuf
+ );
if (l > left)
return 0;
diff -r ddc4ca8ef65f -r 69f90aa310a1 sys/arch/i386/i386/procfs_machdep.c
--- a/sys/arch/i386/i386/procfs_machdep.c Mon Jan 18 21:55:40 2010 +0000
+++ b/sys/arch/i386/i386/procfs_machdep.c Mon Jan 18 22:31:14 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: procfs_machdep.c,v 1.32 2009/08/16 11:04:48 yamt Exp $ */
+/* $NetBSD: procfs_machdep.c,v 1.33 2010/01/18 22:31:14 rmind Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,14 +42,13 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.32 2009/08/16 11:04:48 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.33 2010/01/18 22:31:14 rmind Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/vnode.h>
-#include <sys/proc.h>
#include <miscfs/procfs/procfs.h>
@@ -57,17 +56,18 @@
#include <machine/reg.h>
#include <machine/specialreg.h>
-extern int i386_fpu_present, i386_fpu_exception, i386_fpu_fdivbug;
-extern char cpu_model[];
+extern int i386_fpu_present, i386_fpu_exception, i386_fpu_fdivbug;
+extern char cpu_model[];
-static const char * const i386_features[] = {
+static const char * const x86_features[] = {
+ /* Intel-defined */
"fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
- "cx8", "apic", "10", "sep", "mtrr", "pge", "mca", "cmov",
- "pat", "pse36", "pn", "clflush", "20", "dts", "acpi", "mmx",
- "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "31"
+ "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov",
+ "pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx",
+ "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", NULL
};
-static int procfs_getonecpu(int, struct cpu_info *, char *, int *);
+static int procfs_getonecpu(int, struct cpu_info *, char *, int *);
/*
* Linux-style /proc/cpuinfo.
@@ -96,7 +96,7 @@
*len += used + 1;
used = --total;
if (used == 0)
- break;
+ break;
} else {
*len += used;
break;
@@ -112,10 +112,10 @@
char featurebuf[256], *p;
p = featurebuf;
- left = sizeof featurebuf;
+ left = sizeof(featurebuf);
for (i = 0; i < 32; i++) {
- if (ci->ci_feature_flags & (1 << i)) {
- l = snprintf(p, left, "%s ", i386_features[i]);
+ if ((ci->ci_feature_flags & (1 << i)) && x86_features[i]) {
+ l = snprintf(p, left, "%s ", x86_features[i]);
left -= l;
p += l;
if (left <= 0)
@@ -126,20 +126,18 @@
p = bf;
left = *len;
l = snprintf(p, left,
- "processor\t: %d\n"
- "vendor_id\t: %s\n"
- "cpu family\t: %d\n"
- "model\t\t: %d\n"
- "model name\t: %s\n"
- "stepping\t: ",
- xcpu,
- (char *)ci->ci_vendor,
- cpuid_level >= 0 ?
- ((ci->ci_signature >> 8) & 15) : cpu_class + 3,
- cpuid_level >= 0 ?
- ((ci->ci_signature >> 4) & 15) : 0,
- cpu_brand_string
- );
+ "processor\t: %d\n"
+ "vendor_id\t: %s\n"
+ "cpu family\t: %d\n"
+ "model\t\t: %d\n"
+ "model name\t: %s\n"
+ "stepping\t: ",
+ xcpu,
+ (char *)ci->ci_vendor,
+ cpuid_level >= 0 ? ((ci->ci_signature >> 8) & 15) : cpu_class + 3,
+ cpuid_level >= 0 ? ((ci->ci_signature >> 4) & 15) : 0,
+ cpu_brand_string
+ );
left -= l;
p += l;
@@ -156,7 +154,6 @@
if (left <= 0)
return 0;
-
if (ci->ci_data.cpu_cc_freq != 0) {
uint64_t freq, fraq;
@@ -173,18 +170,25 @@
return 0;
l = snprintf(p, left,
- "fdiv_bug\t: %s\n"
- "fpu\t\t: %s\n"
- "fpu_exception\t: %s\n"
- "cpuid level\t: %d\n"
- "wp\t\t: %s\n"
- "flags\t\t: %s\n",
- i386_fpu_fdivbug ? "yes" : "no",
- i386_fpu_present ? "yes" : "no",
- i386_fpu_exception ? "yes" : "no",
- cpuid_level,
- (rcr0() & CR0_WP) ? "yes" : "no",
- featurebuf);
+ "fdiv_bug\t: %s\n"
+ "fpu\t\t: %s\n"
+ "fpu_exception\t: %s\n"
+ "cpuid level\t: %d\n"
+ "wp\t\t: %s\n"
+ "flags\t\t: %s\n",
+#ifdef __x86_64__
+ "no", /* XXX */
+ "yes", /* XXX */
+ "yes", /* XXX */
+#else
+ i386_fpu_fdivbug ? "yes" : "no",
+ i386_fpu_present ? "yes" : "no",
+ i386_fpu_exception ? "yes" : "no",
+#endif
+ cpuid_level,
+ (rcr0() & CR0_WP) ? "yes" : "no",
Home |
Main Index |
Thread Index |
Old Index