Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5236 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
30 lines
491 B
C
30 lines
491 B
C
#ifndef CPU_X86_TSC_H
|
|
#define CPU_X86_TSC_H
|
|
|
|
struct tsc_struct {
|
|
unsigned lo;
|
|
unsigned hi;
|
|
};
|
|
typedef struct tsc_struct tsc_t;
|
|
|
|
static inline tsc_t rdtsc(void)
|
|
{
|
|
tsc_t res;
|
|
__asm__ __volatile__ (
|
|
"rdtsc"
|
|
: "=a" (res.lo), "=d"(res.hi) /* outputs */
|
|
);
|
|
return res;
|
|
}
|
|
|
|
#if !defined( __ROMCC__ ) && !defined (__PRE_RAM__)
|
|
static inline unsigned long long rdtscll(void)
|
|
{
|
|
unsigned long long val;
|
|
asm volatile ("rdtsc" : "=A" (val));
|
|
return val;
|
|
}
|
|
#endif
|
|
|
|
#endif /* CPU_X86_TSC_H */
|