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

4.115
Last change on this file since 0c0181d was 550c1b23, checked in by Ralf Corsepius <ralf.corsepius@…>, on 02/11/11 at 09:33:50

2011-02-11 Ralf Corsépius <ralf.corsepius@…>

  • cache.c, cpu.h, cpuModel.h: Use "asm" instead of "asm" for improved c99-compliance.
  • 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.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 int x86_capability_ebx;   /* cpuid:EBX */
30extern int x86_capability_cores; /* cpuid.(EAX=4, ECX=0) - physical cores */
31extern char x86_vendor_id[13];
32extern int have_cpuid;
33extern unsigned char Cx86_step; /* cyrix processor identification */
34
35extern void printCpuInfo(); /* Display this information on console in ascii form */
36
37/* determine if the CPU has a TSC */
38#define x86_has_tsc() \
39  (x86_capability & (1 << 4))
40
41static inline unsigned long long
42rdtsc(void)
43{
44  /* Return the value of the on-chip cycle counter. */
45  unsigned long long result;
46  __asm__ volatile(".byte 0x0F, 0x31" : "=A" (result));
47  return result;
48} /* rdtsc */
49
50
51#endif
Note: See TracBrowser for help on using the repository browser.