diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-03-17 19:41:39 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-03-17 19:41:39 +0100 |
commit | 7ae6508d7e804263662fe4595018f3782b483ce3 (patch) | |
tree | 5a976e0ef82eadec90e4bcdb37a5fc8feca78d10 /sys/src | |
parent | d6da605605a1fd5948c46fae8a23a67e8fee3ede (diff) | |
parent | 6862f4ee0e056dc83ec70438916e46547edbb513 (diff) |
merge
Diffstat (limited to 'sys/src')
-rw-r--r-- | sys/src/cmd/aux/cpuid.c | 76 |
1 files changed, 54 insertions, 22 deletions
diff --git a/sys/src/cmd/aux/cpuid.c b/sys/src/cmd/aux/cpuid.c index e0caaeeb0..aae7a68bb 100644 --- a/sys/src/cmd/aux/cpuid.c +++ b/sys/src/cmd/aux/cpuid.c @@ -31,7 +31,7 @@ func0(ulong) { Res r; char buf[13]; - + r = cpuid(0, 0); ((ulong *) buf)[0] = r.bx; ((ulong *) buf)[1] = r.dx; @@ -44,7 +44,7 @@ void printbits(char *id, ulong x, char **s) { int i, j; - + for(i = 0, j = 0; i < 32; i++) if((x & (1<<i)) != 0 && s[i] != nil){ if(j++ % 16 == 0){ @@ -63,17 +63,26 @@ func1(ulong) { Res r; static char *bitsdx[32] = { - "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", "cx8", "apic", - nil, "sep", "mtrr", "pge", "mca", "cmov", "pat", "pse36", "pn", "clflush", - nil, "dts", "acpi", "mmx", "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe", + [0] "fpu", "vme", "de", "pse", + [4] "tsc", "msr", "pae", "mce", + [8] "cx8", "apic", nil, "sep", + [12] "mtrr", "pge", "mca", "cmov", + [16] "pat", "pse36", "pn", "clflush", + [20] nil, "dts", "acpi", "mmx", + [24] "fxsr", "sse", "sse2", "ss", + [28] "ht", "tm", "ia64", "pbe", }; static char *bitscx[32] = { - "pni", "pclmulqdq", "dtes64", "monitor", "ds_cpl", "vmx", "smx", "est", "tm2", "ssse3", - "cid", nil, "fma", "cx16", "xtpr", "pdcm", nil, "pcid", "dca", "sse4_1", "sse4_2", "x2apic", - "movbe", "popcnt", "tscdeadline", "aes", "xsave", "osxsave", "avx", - "f16c", "rdrnd", "hypervisor" + [0] "pni", "pclmulqdq", "dtes64", "monitor", + [4] "ds_cpl", "vmx", "smx", "est", + [8] "tm2", "ssse3", "cid", nil, + [12] "fma", "cx16", "xtpr", "pdcm", + [16] nil, "pcid", "dca", "sse4_1", + [20] "sse4_2", "x2apic", "movbe", "popcnt", + [24] "tscdeadline", "aes", "xsave", "osxsave", + [28] "avx", "f16c", "rdrnd", "hypervisor", }; - + r = cpuid(1, 0); Bprint(out, "procmodel %.8ulx / %.8ulx\n", r.ax, r.bx); printbits("features", r.dx, bitsdx); @@ -81,20 +90,42 @@ func1(ulong) } void +func13(ulong) +{ + Res r; + static char *bitsax[32] = { + [0] "xsaveopt", + }; + + r = cpuid(13, 1); + printbits("features", r.ax, bitsax); +} + +void extfunc1(ulong ax) { Res r; static char *bitsdx[32] = { - "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", "cx8", "apic", "sep", "mtrr", "pge", - "mca", "cmov", "pat", "fcmov", "pse36", nil, "mp", "nx", nil, "mmx+", "mmx", nil, - "ffxsr", "pg1g", "tscp", nil, "lm", "3dnow!+", "3dnow" + [0] "fpu", "vme", "de", "pse", + [4] "tsc", "msr", "pae", "mce", + [8] "cx8", "apic", nil, "syscall", + [12] "mtrr", "pge", "mca", "cmov", + [16] "pat", "pse36", nil, "mp", + [20] "nx", nil, "mmx+", "mmx", + [24] "fxsr", "ffxsr", "pg1g", "tscp", + [28] nil, "lm", "3dnow!+", "3dnow!", }; static char *bitscx[32] = { - "ahf64", "cmp", "svm", "eas", "cr8d", "lzcnt", "sse4a", "msse", "3dnow!p", "osvw", "ibs", - "xop", "skinit", "wdt", nil, "lwp", "fma4", "tce", nil, "nodeid", nil, "tbm", "topx", - "pcx_core", "pcx_nb", + [0] "ahf64", "cmp", "svm", "eas", + [4] "cr8d", "lzcnt", "sse4a", "msse", + [8] "3dnow!p", "osvw", "ibs", "xop", + [12] "skinit", "wdt", nil, "lwp", + [16] "fma4", "tce", nil, "nodeid", + [20] nil, "tbm", "topx", "pcx_core", + [24] "pcx_nb", nil, nil, nil, + [28] nil, nil, nil, nil, }; - + r = cpuid(ax, 0); Bprint(out, "extmodel %.8ulx / %.8ulx\n", r.ax, r.bx); printbits("extfeatures", r.dx, bitsdx); @@ -129,7 +160,7 @@ void extfunc8(ulong ax) { Res r; - + r = cpuid(ax, 0); Bprint(out, "physbits %uld\n", CUT(r.ax, 0, 7)); Bprint(out, "virtbits %uld\n", CUT(r.ax, 8, 15)); @@ -138,8 +169,9 @@ extfunc8(ulong ax) } void (*funcs[])(ulong) = { - [0] func0, - [1] func1, + [0] func0, + [1] func1, + [13] func13, }; void (*extfuncs[])(ulong) = { @@ -154,7 +186,7 @@ void stdfunc(ulong ax) { Res r; - + r = cpuid(ax, 0); Bprint(out, "%.8ulx %.8ulx %.8ulx %.8ulx %.8ulx\n", ax, r.ax, r.bx, r.cx, r.dx); } @@ -176,7 +208,7 @@ main(int argc, char **argv) int i, rflag, aflag; ulong w; static Biobuf buf; - + rflag = aflag = 0; ARGBEGIN { case 'r': rflag++; break; |