1 | /* $Id: cpuid.c 2280 2005-08-20 21:24:40Z bird $ */
|
---|
2 | /** @file
|
---|
3 | *
|
---|
4 | * The start of a cpuid dumper.
|
---|
5 | *
|
---|
6 | * Copyright (c) 2005 knut st. osmundsen <bird@anduin.net>
|
---|
7 | *
|
---|
8 | *
|
---|
9 | * This file is part of InnoTek LIBC.
|
---|
10 | *
|
---|
11 | * InnoTek LIBC is free software; you can redistribute it and/or modify
|
---|
12 | * it under the terms of the GNU General Public License as published by
|
---|
13 | * the Free Software Foundation; either version 2 of the License, or
|
---|
14 | * (at your option) any later version.
|
---|
15 | *
|
---|
16 | * InnoTek LIBC is distributed in the hope that it will be useful,
|
---|
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
19 | * GNU General Public License for more details.
|
---|
20 | *
|
---|
21 | * You should have received a copy of the GNU General Public License
|
---|
22 | * along with InnoTek LIBC; if not, write to the Free Software
|
---|
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
24 | *
|
---|
25 | */
|
---|
26 |
|
---|
27 | #include <stdio.h>
|
---|
28 |
|
---|
29 | #define BIT(n) (1 << n)
|
---|
30 | int main()
|
---|
31 | {
|
---|
32 | unsigned eax, edx, ecx, ebx;
|
---|
33 | __asm__ ("cpuid" : "=a" (eax), "=d" (edx), "=c" (ecx), "=b" (ebx) : "0" (1));
|
---|
34 | printf("1: edx=%#x ecx=%#x eax=%#x ebx=%#x\n", edx, ecx, eax, ebx);
|
---|
35 | if (edx & BIT(0)) printf("FPU ");
|
---|
36 | if (edx & BIT(1)) printf("VME ");
|
---|
37 | if (edx & BIT(2)) printf("DE ");
|
---|
38 | if (edx & BIT(3)) printf("PSE ");
|
---|
39 | if (edx & BIT(4)) printf("TSC ");
|
---|
40 | if (edx & BIT(5)) printf("MSR ");
|
---|
41 | if (edx & BIT(6)) printf("PAE ");
|
---|
42 | if (edx & BIT(7)) printf("MCE ");
|
---|
43 | if (edx & BIT(8)) printf("CX8 ");
|
---|
44 | if (edx & BIT(9)) printf("APIC ");
|
---|
45 | if (edx & BIT(10)) printf("10 ");
|
---|
46 | if (edx & BIT(11)) printf("SEP ");
|
---|
47 | if (edx & BIT(12)) printf("MTRR ");
|
---|
48 | if (edx & BIT(13)) printf("PGE ");
|
---|
49 | if (edx & BIT(14)) printf("MCA ");
|
---|
50 | if (edx & BIT(15)) printf("CMOV ");
|
---|
51 | if (edx & BIT(16)) printf("PAT ");
|
---|
52 | if (edx & BIT(17)) printf("PSE36 ");
|
---|
53 | if (edx & BIT(18)) printf("PSN ");
|
---|
54 | if (edx & BIT(19)) printf("CLFSH ");
|
---|
55 | if (edx & BIT(20)) printf("20 ");
|
---|
56 | if (edx & BIT(21)) printf("DS ");
|
---|
57 | if (edx & BIT(22)) printf("ACPI ");
|
---|
58 | if (edx & BIT(23)) printf("MMX ");
|
---|
59 | if (edx & BIT(24)) printf("FXSR ");
|
---|
60 | if (edx & BIT(25)) printf("SSE ");
|
---|
61 | if (edx & BIT(26)) printf("SSE2 ");
|
---|
62 | if (edx & BIT(27)) printf("SS ");
|
---|
63 | if (edx & BIT(28)) printf("28 ");
|
---|
64 | if (edx & BIT(29)) printf("29 ");
|
---|
65 | if (edx & BIT(30)) printf("30 ");
|
---|
66 | if (edx & BIT(31)) printf("31 ");
|
---|
67 | printf("\n");
|
---|
68 |
|
---|
69 | return 0;
|
---|
70 | }
|
---|