diff options
author | des <des@FreeBSD.org> | 2000-10-25 22:38:23 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2000-10-25 22:38:23 +0000 |
commit | 6f876111db73c027a544e260a883ec8ad382e564 (patch) | |
tree | aafd2671a68549bb2c297c6f202c73836b3d4fd9 /sys/i386/linux | |
parent | 6928b6c1244151d67e9aea7e7ea73fb4ab40949c (diff) | |
download | FreeBSD-src-6f876111db73c027a544e260a883ec8ad382e564.zip FreeBSD-src-6f876111db73c027a544e260a883ec8ad382e564.tar.gz |
Bring cpuinfo closer to what it looks like in Linux 2.2.
Submitted by: R Bradford Jones <brad@kazrak.com>
Diffstat (limited to 'sys/i386/linux')
-rw-r--r-- | sys/i386/linux/linprocfs/linprocfs_misc.c | 58 |
1 files changed, 47 insertions, 11 deletions
diff --git a/sys/i386/linux/linprocfs/linprocfs_misc.c b/sys/i386/linux/linprocfs/linprocfs_misc.c index 59594d5..b985916 100644 --- a/sys/i386/linux/linprocfs/linprocfs_misc.c +++ b/sys/i386/linux/linprocfs/linprocfs_misc.c @@ -61,8 +61,9 @@ #include <sys/vmmeter.h> #include <sys/exec.h> -#include <machine/md_var.h> +#include <machine/clock.h> #include <machine/cputypes.h> +#include <machine/md_var.h> #include <i386/linux/linprocfs/linprocfs.h> @@ -171,44 +172,79 @@ linprocfs_docpuinfo(curp, p, pfs, uio) char *ps; int xlen; char psbuf[512]; /* XXX - conservative */ - char *class; + int class; + int i; #if 0 extern char *cpu_model; /* Yuck */ #endif + /* We default the flags to include all non-conflicting flags, + and the Intel versions of conflicting flags. Note the space + before each name; that is significant, and should be + preserved. */ + + static char *flags[] = { + "fpu", "vme", "de", "pse", "tsc", + "msr", "pae", "mce", "cx8", "apic", + "sep", "sep", "mtrr", "pge", "mca", + "cmov", "pat", "pse36", "pn", "b19", + "b20", "b21", "mmxext", "mmx", "fxsr", + "xmm", "b26", "b27", "b28", "b29", + "3dnowext", "3dnow" + }; if (uio->uio_rw != UIO_READ) return (EOPNOTSUPP); switch (cpu_class) { case CPUCLASS_286: - class = "286"; + class = 2; break; case CPUCLASS_386: - class = "386"; + class = 3; break; case CPUCLASS_486: - class = "486"; + class = 4; break; case CPUCLASS_586: - class = "586"; + class = 5; break; case CPUCLASS_686: - class = "686"; + class = 6; break; default: - class = "unknown"; + class = 0; break; } ps = psbuf; ps += sprintf(ps, "processor : %d\n" - "cpu : %.3s\n" - "model : %.20s\n" "vendor_id : %.20s\n" + "cpu family : %d\n" + "model : %d\n" "stepping : %d\n", - 0, class, "unknown", cpu_vendor, cpu_id); + 0, cpu_vendor, class, cpu, cpu_id & 0xf); + ps += sprintf(ps, + "flags :"); + + if (!strcmp(cpu_vendor, "AuthenticAMD") && (class < 6)) { + flags[16] = "fcmov"; + } else if (!strcmp(cpu_vendor, "CyrixInstead")) { + flags[24] = "cxmmx"; + } + + for (i = 0; i < 32; i++) + if (cpu_feature & (1 << i)) + ps += sprintf(ps, " %s", flags[i]); + ps += sprintf(ps, "\n"); + if (class >= 5) { + ps += sprintf(ps, + "cpu MHz : %d.%02d\n", + (tsc_freq + 4999) / 1000000, + ((tsc_freq + 4999) / 10000) % 100); + } + xlen = ps - psbuf; xlen -= uio->uio_offset; ps = psbuf + uio->uio_offset; |