cpu.h
Go to the documentation of this file.00001 #ifndef I386_BITS_CPU_H
00002 #define I386_BITS_CPU_H
00003
00004
00005 #define X86_FEATURE_FPU 0
00006 #define X86_FEATURE_VME 1
00007 #define X86_FEATURE_DE 2
00008 #define X86_FEATURE_PSE 3
00009 #define X86_FEATURE_TSC 4
00010 #define X86_FEATURE_MSR 5
00011 #define X86_FEATURE_PAE 6
00012 #define X86_FEATURE_MCE 7
00013 #define X86_FEATURE_CX8 8
00014 #define X86_FEATURE_APIC 9
00015 #define X86_FEATURE_SEP 11
00016 #define X86_FEATURE_MTRR 12
00017 #define X86_FEATURE_PGE 13
00018 #define X86_FEATURE_MCA 14
00019 #define X86_FEATURE_CMOV 15
00020 #define X86_FEATURE_PAT 16
00021 #define X86_FEATURE_PSE36 17
00022 #define X86_FEATURE_PN 18
00023 #define X86_FEATURE_CLFLSH 19
00024 #define X86_FEATURE_DTES 21
00025 #define X86_FEATURE_ACPI 22
00026 #define X86_FEATURE_MMX 23
00027 #define X86_FEATURE_FXSR 24
00028
00029 #define X86_FEATURE_XMM 25
00030 #define X86_FEATURE_XMM2 26
00031 #define X86_FEATURE_SELFSNOOP 27
00032 #define X86_FEATURE_HT 28
00033 #define X86_FEATURE_ACC 29
00034 #define X86_FEATURE_IA64 30
00035
00036
00037
00038 #define X86_FEATURE_SYSCALL 11
00039 #define X86_FEATURE_MMXEXT 22
00040 #define X86_FEATURE_LM 29
00041 #define X86_FEATURE_3DNOWEXT 30
00042 #define X86_FEATURE_3DNOW 31
00043
00044
00045 struct cpuinfo_x86 {
00046
00047 unsigned int features;
00048
00049 unsigned int amd_features;
00050 };
00051
00052
00053
00054
00055 #define X86_EFLAGS_CF 0x00000001
00056 #define X86_EFLAGS_PF 0x00000004
00057 #define X86_EFLAGS_AF 0x00000010
00058 #define X86_EFLAGS_ZF 0x00000040
00059 #define X86_EFLAGS_SF 0x00000080
00060 #define X86_EFLAGS_TF 0x00000100
00061 #define X86_EFLAGS_IF 0x00000200
00062 #define X86_EFLAGS_DF 0x00000400
00063 #define X86_EFLAGS_OF 0x00000800
00064 #define X86_EFLAGS_IOPL 0x00003000
00065 #define X86_EFLAGS_NT 0x00004000
00066 #define X86_EFLAGS_RF 0x00010000
00067 #define X86_EFLAGS_VM 0x00020000
00068 #define X86_EFLAGS_AC 0x00040000
00069 #define X86_EFLAGS_VIF 0x00080000
00070 #define X86_EFLAGS_VIP 0x00100000
00071 #define X86_EFLAGS_ID 0x00200000
00072
00073
00074
00075
00076 static inline __attribute__ (( always_inline )) void
00077 cpuid ( int op, unsigned int *eax, unsigned int *ebx,
00078 unsigned int *ecx, unsigned int *edx ) {
00079 __asm__ ( "cpuid" :
00080 "=a" ( *eax ), "=b" ( *ebx ), "=c" ( *ecx ), "=d" ( *edx )
00081 : "0" ( op ) );
00082 }
00083
00084 extern void get_cpuinfo ( struct cpuinfo_x86 *cpu );
00085
00086 #endif