Adding upstream version 4.02+dfsg.
[syslinux-debian/hramrach.git] / com32 / modules / cpuidtest.c
blobb7688852295652bdb1bc67b4d3654e7a77216cc8
1 /* ----------------------------------------------------------------------- *
3 * Copyright 2006 Erwan Velu - All Rights Reserved
5 * Permission is hereby granted, free of charge, to any person
6 * obtaining a copy of this software and associated documentation
7 * files (the "Software"), to deal in the Software without
8 * restriction, including without limitation the rights to use,
9 * copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom
11 * the Software is furnished to do so, subject to the following
12 * conditions:
14 * The above copyright notice and this permission notice shall
15 * be included in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 * OTHER DEALINGS IN THE SOFTWARE.
26 * -----------------------------------------------------------------------
30 * cpuidtest.c
32 * A CPUID demo program using libcom32
35 #include <string.h>
36 #include <stdio.h>
37 #include <console.h>
38 #include "cpuid.h"
40 char display_line;
42 int main(void)
44 s_cpu cpu;
45 openconsole(&dev_stdcon_r, &dev_stdcon_w);
47 for (;;) {
48 detect_cpu(&cpu);
49 printf("Vendor = %s\n", cpu.vendor);
50 printf("Model = %s\n", cpu.model);
51 printf("Vendor ID = %d\n", cpu.vendor_id);
52 printf("Family = %d\n", cpu.family);
53 printf("Model ID = %d\n", cpu.model_id);
54 printf("Stepping = %d\n", cpu.stepping);
55 printf("Flags = ");
56 if (cpu.flags.fpu)
57 printf("fpu ");
58 if (cpu.flags.vme)
59 printf("vme ");
60 if (cpu.flags.de)
61 printf("de ");
62 if (cpu.flags.pse)
63 printf("pse ");
64 if (cpu.flags.tsc)
65 printf("tsc ");
66 if (cpu.flags.msr)
67 printf("msr ");
68 if (cpu.flags.pae)
69 printf("pae ");
70 if (cpu.flags.mce)
71 printf("mce ");
72 if (cpu.flags.cx8)
73 printf("cx8 ");
74 if (cpu.flags.apic)
75 printf("apic ");
76 if (cpu.flags.sep)
77 printf("sep ");
78 if (cpu.flags.mtrr)
79 printf("mtrr ");
80 if (cpu.flags.pge)
81 printf("pge ");
82 if (cpu.flags.mca)
83 printf("mca ");
84 if (cpu.flags.cmov)
85 printf("cmov ");
86 if (cpu.flags.pat)
87 printf("pat ");
88 if (cpu.flags.pse_36)
89 printf("pse_36 ");
90 if (cpu.flags.psn)
91 printf("psn ");
92 if (cpu.flags.clflsh)
93 printf("clflsh ");
94 if (cpu.flags.dts)
95 printf("dts ");
96 if (cpu.flags.acpi)
97 printf("acpi ");
98 if (cpu.flags.mmx)
99 printf("mmx ");
100 if (cpu.flags.sse)
101 printf("sse ");
102 if (cpu.flags.sse2)
103 printf("sse2 ");
104 if (cpu.flags.ss)
105 printf("ss ");
106 if (cpu.flags.htt)
107 printf("ht ");
108 if (cpu.flags.acc)
109 printf("acc ");
110 if (cpu.flags.syscall)
111 printf("syscall ");
112 if (cpu.flags.mp)
113 printf("mp ");
114 if (cpu.flags.nx)
115 printf("nx ");
116 if (cpu.flags.mmxext)
117 printf("mmxext ");
118 if (cpu.flags.lm)
119 printf("lm ");
120 if (cpu.flags.nowext)
121 printf("3dnowext ");
122 if (cpu.flags.now)
123 printf("3dnow! ");
124 if (cpu.flags.vmx)
125 printf("vmx ");
126 if (cpu.flags.svm)
127 printf("svm ");
128 printf("\n");
129 printf("SMP = ");
130 if (cpu.flags.smp)
131 printf("yes\n");
132 else
133 printf("no\n");
134 break;
137 return 0;