source: rtems/c/src/lib/libcpu/i386/cpuModel.h @ c499856

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 1.4 KB
Line 
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
21extern char hard_math;  /* floating point coprocessor present indicator */
22extern char x86;        /* type of cpu (3 = 386, 4 =486, ...) */
23extern char x86_model;
24extern char x86_mask;
25extern int x86_capability;       /* cpuid:EDX */
26extern int x86_capability_x;     /* cpuid:ECX */
27extern int x86_capability_ebx;   /* cpuid:EBX */
28extern int x86_capability_cores; /* cpuid.(EAX=4, ECX=0) - physical cores */
29extern char x86_vendor_id[13];
30extern int have_cpuid;
31extern unsigned char Cx86_step; /* cyrix processor identification */
32
33extern 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
39static inline unsigned long long
40rdtsc(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
Note: See TracBrowser for help on using the repository browser.