summaryrefslogtreecommitdiff
path: root/sys/src/cmd/aux/cpuid.c
diff options
context:
space:
mode:
authoraiju <devnull@localhost>2017-06-12 19:36:52 +0000
committeraiju <devnull@localhost>2017-06-12 19:36:52 +0000
commitdae0f4d28d3ffa312cab5d751045b1bbab1d897d (patch)
treecc2eb15778ea3a2219976eeb961753d893fe32d8 /sys/src/cmd/aux/cpuid.c
parent744a4a8270d076a5fe3d18c40b80012f1066245a (diff)
aux/cpuid: decode family and model bitfields
Diffstat (limited to 'sys/src/cmd/aux/cpuid.c')
-rw-r--r--sys/src/cmd/aux/cpuid.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/src/cmd/aux/cpuid.c b/sys/src/cmd/aux/cpuid.c
index 632add489..122870242 100644
--- a/sys/src/cmd/aux/cpuid.c
+++ b/sys/src/cmd/aux/cpuid.c
@@ -71,6 +71,7 @@ void
func1(ulong)
{
Res r;
+ int family, model;
static char *bitsdx[32] = {
[0] "fpu", "vme", "de", "pse",
[4] "tsc", "msr", "pae", "mce",
@@ -94,6 +95,13 @@ func1(ulong)
r = cpuid(1, 0);
Bprint(out, "procmodel %.8ulx / %.8ulx\n", r.ax, r.bx);
+ family = r.ax >> 8 & 0xf;
+ model = r.ax >> 8 & 0xf;
+ if(family == 15)
+ family += r.ax >> 20 & 0xff;
+ if(family == 6 || family == 15)
+ model += r.ax >> 12 & 0xf0;
+ Bprint(out, "typefammod %.1x %.2x %.3x %.1x\n", (int)(r.ax >> 12 & 3), family, model, (int)(r.ax & 0xf));
printbits("features", r.dx, bitsdx);
printbits("features", r.cx, bitscx);
}