7 #define X86_EFLAGS_CF 0x00000001 /* Carry Flag */
8 #define X86_EFLAGS_PF 0x00000004 /* Parity Flag */
9 #define X86_EFLAGS_AF 0x00000010 /* Auxillary carry Flag */
10 #define X86_EFLAGS_ZF 0x00000040 /* Zero Flag */
11 #define X86_EFLAGS_SF 0x00000080 /* Sign Flag */
12 #define X86_EFLAGS_TF 0x00000100 /* Trap Flag */
13 #define X86_EFLAGS_IF 0x00000200 /* Interrupt Flag */
14 #define X86_EFLAGS_DF 0x00000400 /* Direction Flag */
15 #define X86_EFLAGS_OF 0x00000800 /* Overflow Flag */
16 #define X86_EFLAGS_IOPL 0x00003000 /* IOPL mask */
17 #define X86_EFLAGS_NT 0x00004000 /* Nested Task */
18 #define X86_EFLAGS_RF 0x00010000 /* Resume Flag */
19 #define X86_EFLAGS_VM 0x00020000 /* Virtual Mode */
20 #define X86_EFLAGS_AC 0x00040000 /* Alignment Check */
21 #define X86_EFLAGS_VIF 0x00080000 /* Virtual Interrupt Flag */
22 #define X86_EFLAGS_VIP 0x00100000 /* Virtual Interrupt Pending */
23 #define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */
33 * Generic CPUID function
35 static inline struct cpuid_result cpuid(int op)
37 struct cpuid_result result;
53 * Generic Extended CPUID function
55 static inline struct cpuid_result cpuid_ext(int op, unsigned ecx)
57 struct cpuid_result result;
73 * CPUID functions returning a single datum
75 static inline unsigned int cpuid_eax(unsigned int op)
79 __asm__("mov %%ebx, %%edi;"
84 : "ecx", "edx", "edi");
88 static inline unsigned int cpuid_ebx(unsigned int op)
90 unsigned int eax, ebx;
92 __asm__("mov %%ebx, %%edi;"
96 : "=a" (eax), "=S" (ebx)
98 : "ecx", "edx", "edi");
102 static inline unsigned int cpuid_ecx(unsigned int op)
104 unsigned int eax, ecx;
106 __asm__("mov %%ebx, %%edi;"
109 : "=a" (eax), "=c" (ecx)
115 static inline unsigned int cpuid_edx(unsigned int op)
117 unsigned int eax, edx;
119 __asm__("mov %%ebx, %%edi;"
122 : "=a" (eax), "=d" (edx)
128 #define X86_VENDOR_INVALID 0
129 #define X86_VENDOR_INTEL 1
130 #define X86_VENDOR_CYRIX 2
131 #define X86_VENDOR_AMD 3
132 #define X86_VENDOR_UMC 4
133 #define X86_VENDOR_NEXGEN 5
134 #define X86_VENDOR_CENTAUR 6
135 #define X86_VENDOR_RISE 7
136 #define X86_VENDOR_TRANSMETA 8
137 #define X86_VENDOR_NSC 9
138 #define X86_VENDOR_SIS 10
139 #define X86_VENDOR_UNKNOWN 0xff
141 #if !defined(__PRE_RAM__)
142 #include <device/device.h>
144 int cpu_phys_address_size(void);
145 int cpu_have_cpuid(void);
147 struct cpu_device_id {
153 struct device_operations *ops;
154 struct cpu_device_id *id_table;
162 static inline struct cpu_info *cpu_info(void)
165 __asm__("andl %%esp,%0; "
168 : "0" (~(CONFIG_STACK_SIZE - 1)),
169 "r" (CONFIG_STACK_SIZE - sizeof(struct cpu_info))
174 static inline unsigned long cpu_index(void)
182 uint8_t x86; /* CPU family */
183 uint8_t x86_vendor; /* CPU vendor */
188 static void inline get_fms(struct cpuinfo_x86 *c, uint32_t tfms)
190 c->x86 = (tfms >> 8) & 0xf;
191 c->x86_model = (tfms >> 4) & 0xf;
192 c->x86_mask = tfms & 0xf;
194 c->x86 += (tfms >> 20) & 0xff;
196 c->x86_model += ((tfms >> 16) & 0xF) << 4;
201 #endif /* ARCH_CPU_H */