1 | /* cpuModel.h |
---|
2 | * |
---|
3 | * This file contains declaration for variables and code |
---|
4 | * that may be used to get the Intel Cpu identification |
---|
5 | * that has been performed by checkCPUtypeSetCr0 function. |
---|
6 | * |
---|
7 | * COPYRIGHT (c) 1998 valette@crf.canon.fr |
---|
8 | * |
---|
9 | * The license and distribution terms for this file may be |
---|
10 | * found in the file LICENSE in this distribution or at |
---|
11 | * http://www.rtems.org/license/LICENSE. |
---|
12 | */ |
---|
13 | |
---|
14 | #ifndef libcpu_cpuModel_h |
---|
15 | #define libcpu_cpuModel_h |
---|
16 | |
---|
17 | /* |
---|
18 | * Tell us the machine setup.. |
---|
19 | */ |
---|
20 | |
---|
21 | extern char hard_math; /* floating point coprocessor present indicator */ |
---|
22 | extern char x86; /* type of cpu (3 = 386, 4 =486, ...) */ |
---|
23 | extern char x86_model; |
---|
24 | extern char x86_mask; |
---|
25 | extern int x86_capability; /* cpuid:EDX */ |
---|
26 | extern int x86_capability_x; /* cpuid:ECX */ |
---|
27 | extern int x86_capability_ebx; /* cpuid:EBX */ |
---|
28 | extern int x86_capability_cores; /* cpuid.(EAX=4, ECX=0) - physical cores */ |
---|
29 | extern char x86_vendor_id[13]; |
---|
30 | extern int have_cpuid; |
---|
31 | extern unsigned char Cx86_step; /* cyrix processor identification */ |
---|
32 | |
---|
33 | extern void printCpuInfo(); /* Display this information on console in ascii form */ |
---|
34 | |
---|
35 | /* determine if the CPU has a TSC */ |
---|
36 | #define x86_has_tsc() \ |
---|
37 | (x86_capability & (1 << 4)) |
---|
38 | |
---|
39 | static inline unsigned long long |
---|
40 | rdtsc(void) |
---|
41 | { |
---|
42 | /* Return the value of the on-chip cycle counter. */ |
---|
43 | unsigned long long result; |
---|
44 | __asm__ volatile(".byte 0x0F, 0x31" : "=A" (result)); |
---|
45 | return result; |
---|
46 | } /* rdtsc */ |
---|
47 | |
---|
48 | |
---|
49 | #endif |
---|