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

4.104.115
Last change on this file since caf761f was caf761f, checked in by Till Straumann <strauman@…>, on 10/28/09 at 21:40:14

2009-10-28 Till Straumann <strauman@…>

  • cpuModel.S, cpuModel.h, displayCpu.c: Save/cache CPUID:ECX (extended capabilities) in a new variable (x86_capability_x). Added more known flag description strings (printCpuInfo()) and let 'printCpuInfo()' dump the extended feature flags, too.
  • Property mode set to 100644
File size: 1.3 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.com/license/LICENSE.
12 *
13 *  $Id$
14 */
15
16#ifndef libcpu_cpuModel_h
17#define libcpu_cpuModel_h
18
19/*
20 * Tell us the machine setup..
21 */
22
23extern char hard_math;  /* floating point coprocessor present indicator */
24extern char x86;        /* type of cpu (3 = 386, 4 =486, ...) */
25extern char x86_model;
26extern char x86_mask;
27extern int x86_capability;      /* cpuid:EDX */
28extern int x86_capability_x;    /* cpuid:ECX */
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.