1 #ifndef _GPXE_RDTSC_TIMER_H
2 #define _GPXE_RDTSC_TIMER_H
10 FILE_LICENCE ( GPL2_OR_LATER
);
13 #define TIMER_PREFIX_rdtsc
15 #define TIMER_PREFIX_rdtsc __rdtsc_
19 * RDTSC values can easily overflow an unsigned long. We discard the
20 * low-order bits in order to obtain sensibly-scaled values.
25 * Get current system time in ticks
27 * @ret ticks Current time, in ticks
29 static inline __always_inline
unsigned long
30 TIMER_INLINE ( rdtsc
, currticks
) ( void ) {
33 __asm__
__volatile__ ( "rdtsc\n\t"
34 "shrdl %1, %%edx, %%eax\n\t"
35 : "=a" ( ticks
) : "i" ( TSC_SHIFT
) : "edx" );
39 #endif /* _GPXE_RDTSC_TIMER_H */