Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:40

0001 /*
0002  *  This file contains declaration for variables and code
0003  *  that may be used to get the Intel Cpu identification
0004  *  that has been performed by checkCPUtypeSetCr0 function.
0005  */
0006 
0007 /*
0008  *  COPYRIGHT (c) 1998 valette@crf.canon.fr
0009  *
0010  *  The license and distribution terms for this file may be
0011  *  found in the file LICENSE in this distribution or at
0012  *  http://www.rtems.org/license/LICENSE.
0013  */
0014 
0015 #ifndef libcpu_cpuModel_h
0016 #define libcpu_cpuModel_h
0017 
0018 /*
0019  * Tell us the machine setup..
0020  */
0021 
0022 extern char hard_math;  /* floating point coprocessor present indicator */
0023 extern char x86;    /* type of cpu (3 = 386, 4 =486, ...) */
0024 extern char x86_model;
0025 extern char x86_mask;
0026 extern int x86_capability;       /* cpuid:EDX */
0027 extern int x86_capability_x;     /* cpuid:ECX */
0028 extern int x86_capability_ebx;   /* cpuid:EBX */
0029 extern int x86_capability_cores; /* cpuid.(EAX=4, ECX=0) - physical cores */
0030 extern char x86_vendor_id[13];
0031 extern int have_cpuid;
0032 extern unsigned char Cx86_step; /* cyrix processor identification */
0033 
0034 /* Display this information on console in ascii form */
0035 extern void printCpuInfo(void);
0036 
0037 /* determine if the CPU has a TSC */
0038 #define x86_has_tsc() \
0039   (x86_capability & (1 << 4))
0040 
0041 static inline unsigned long long
0042 rdtsc(void)
0043 {
0044   /* Return the value of the on-chip cycle counter. */
0045   unsigned long long result;
0046   __asm__ volatile(".byte 0x0F, 0x31" : "=A" (result));
0047   return result;
0048 } /* rdtsc */
0049 
0050 
0051 #endif