source: bootcd/isolinux/syslinux-6.03/com32/modules/cpuidtest.c @ 26ffad7

Last change on this file since 26ffad7 was e16e8f2, checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago

bootstuff

  • Property mode set to 100644
File size: 3.4 KB
Line 
1/* ----------------------------------------------------------------------- *
2 *
3 *   Copyright 2006 Erwan Velu - All Rights Reserved
4 *
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:
13 *
14 *   The above copyright notice and this permission notice shall
15 *   be included in all copies or substantial portions of the Software.
16 *
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.
25 *
26 * -----------------------------------------------------------------------
27*/
28
29/*
30 * cpuidtest.c
31 *
32 * A CPUID demo program using libcom32
33 */
34
35#include <string.h>
36#include <stdio.h>
37#include <console.h>
38#include "cpuid.h"
39
40char display_line;
41
42int main(void)
43{
44    s_cpu cpu;
45
46    for (;;) {
47        detect_cpu(&cpu);
48        printf("Vendor      = %s\n", cpu.vendor);
49        printf("Model       = %s\n", cpu.model);
50        printf("Vendor ID   = %d\n", cpu.vendor_id);
51        printf("Family      = %d\n", cpu.family);
52        printf("Model ID    = %d\n", cpu.model_id);
53        printf("Stepping    = %d\n", cpu.stepping);
54        printf("Flags       = ");
55        if (cpu.flags.fpu)
56            printf("fpu ");
57        if (cpu.flags.vme)
58            printf("vme ");
59        if (cpu.flags.de)
60            printf("de ");
61        if (cpu.flags.pse)
62            printf("pse ");
63        if (cpu.flags.tsc)
64            printf("tsc ");
65        if (cpu.flags.msr)
66            printf("msr ");
67        if (cpu.flags.pae)
68            printf("pae ");
69        if (cpu.flags.mce)
70            printf("mce ");
71        if (cpu.flags.cx8)
72            printf("cx8 ");
73        if (cpu.flags.apic)
74            printf("apic ");
75        if (cpu.flags.sep)
76            printf("sep ");
77        if (cpu.flags.mtrr)
78            printf("mtrr ");
79        if (cpu.flags.pge)
80            printf("pge ");
81        if (cpu.flags.mca)
82            printf("mca ");
83        if (cpu.flags.cmov)
84            printf("cmov ");
85        if (cpu.flags.pat)
86            printf("pat ");
87        if (cpu.flags.pse_36)
88            printf("pse_36 ");
89        if (cpu.flags.psn)
90            printf("psn ");
91        if (cpu.flags.clflsh)
92            printf("clflsh ");
93        if (cpu.flags.dts)
94            printf("dts ");
95        if (cpu.flags.acpi)
96            printf("acpi ");
97        if (cpu.flags.mmx)
98            printf("mmx ");
99        if (cpu.flags.sse)
100            printf("sse ");
101        if (cpu.flags.sse2)
102            printf("sse2 ");
103        if (cpu.flags.ss)
104            printf("ss ");
105        if (cpu.flags.htt)
106            printf("ht ");
107        if (cpu.flags.acc)
108            printf("acc ");
109        if (cpu.flags.syscall)
110            printf("syscall ");
111        if (cpu.flags.mp)
112            printf("mp ");
113        if (cpu.flags.nx)
114            printf("nx ");
115        if (cpu.flags.mmxext)
116            printf("mmxext ");
117        if (cpu.flags.lm)
118            printf("lm ");
119        if (cpu.flags.nowext)
120            printf("3dnowext ");
121        if (cpu.flags.now)
122            printf("3dnow! ");
123        if (cpu.flags.vmx)
124            printf("vmx ");
125        if (cpu.flags.svm)
126            printf("svm ");
127        printf("\n");
128        printf("SMP         = ");
129        if (cpu.flags.smp)
130            printf("yes\n");
131        else
132            printf("no\n");
133        break;
134    }
135
136    return 0;
137}
Note: See TracBrowser for help on using the repository browser.