Add support to run SMM handler in TSEG instead of ASEG
[coreboot.git] / src / include / cpu / x86 / tsc.h
1 #ifndef CPU_X86_TSC_H
2 #define CPU_X86_TSC_H
3
4 struct tsc_struct {
5         unsigned lo;
6         unsigned hi;
7 };
8 typedef struct tsc_struct tsc_t;
9
10 static inline tsc_t rdtsc(void)
11 {
12         tsc_t res;
13         __asm__ __volatile__ (
14                 "rdtsc"
15                 : "=a" (res.lo), "=d"(res.hi) /* outputs */
16                 );
17         return res;
18 }
19
20 #if !defined(__ROMCC__)
21 /* Too many registers for ROMCC */
22 static inline unsigned long long rdtscll(void)
23 {
24         unsigned long long val;
25         asm volatile ("rdtsc" : "=A" (val));
26         return val;
27 }
28 #endif
29
30 #endif /* CPU_X86_TSC_H */