merge
This commit is contained in:
commit
7ae6508d7e
1 changed files with 54 additions and 22 deletions
|
@ -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,38 +63,69 @@ 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);
|
||||
printbits("features", r.cx, bitscx);
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue