7 typedef __builtin_msr_t msr_t;
9 static msr_t rdmsr(unsigned long index)
11 return __builtin_rdmsr(index);
14 static void wrmsr(unsigned long index, msr_t msr)
16 __builtin_wrmsr(index, msr.lo, msr.hi);
24 typedef struct tsc_struct tsc_t;
26 static tsc_t rdtsc(void)
30 : "=a" (res.lo), "=d"(res.hi) /* outputs */
40 typedef struct msr_struct
46 static inline msr_t rdmsr(unsigned index)
49 __asm__ __volatile__ (
51 : "=a" (result.lo), "=d" (result.hi)
57 static inline void wrmsr(unsigned index, msr_t msr)
59 __asm__ __volatile__ (
62 : "c" (index), "a" (msr.lo), "d" (msr.hi)
66 typedef struct tsc_struct
72 static inline tsc_t rdtsc(void)
77 : "=a" (result.lo), "=d" (result.hi)
82 typedef struct pmc_struct
88 static inline pmc_t rdpmc(unsigned counter)
93 : "=a" (result.lo), "=d" (result.hi)
101 #endif /* CPU_P6_MSR_H */