1 #ifndef _GPXE_RDTSC_TIMER_H
2 #define _GPXE_RDTSC_TIMER_H
11 #define TIMER_PREFIX_rdtsc
13 #define TIMER_PREFIX_rdtsc __rdtsc_
17 * RDTSC values can easily overflow an unsigned long. We discard the
18 * low-order bits in order to obtain sensibly-scaled values.
23 * Get current system time in ticks
25 * @ret ticks Current time, in ticks
27 static inline __always_inline unsigned long
28 TIMER_INLINE ( rdtsc, currticks ) ( void ) {
31 __asm__ __volatile__ ( "rdtsc\n\t"
32 "shrdl %1, %%edx, %%eax\n\t"
33 : "=a" ( ticks ) : "i" ( TSC_SHIFT ) : "edx" );
37 #endif /* _GPXE_RDTSC_TIMER_H */