rdtsc_timer.h
Go to the documentation of this file.00001 #ifndef _GPXE_RDTSC_TIMER_H
00002 #define _GPXE_RDTSC_TIMER_H
00003
00004
00005
00006
00007
00008
00009
00010 FILE_LICENCE ( GPL2_OR_LATER );
00011
00012 #ifdef TIMER_RDTSC
00013 #define TIMER_PREFIX_rdtsc
00014 #else
00015 #define TIMER_PREFIX_rdtsc __rdtsc_
00016 #endif
00017
00018
00019
00020
00021
00022 #define TSC_SHIFT 8
00023
00024
00025
00026
00027
00028
00029 static inline __always_inline unsigned long
00030 TIMER_INLINE ( rdtsc, currticks ) ( void ) {
00031 unsigned long ticks;
00032
00033 __asm__ __volatile__ ( "rdtsc\n\t"
00034 "shrdl %1, %%edx, %%eax\n\t"
00035 : "=a" ( ticks ) : "i" ( TSC_SHIFT ) : "edx" );
00036 return ticks;
00037 }
00038
00039 #endif