- Initial checkin of the freebios2 tree
[coreboot.git] / src / include / cpu / p6 / msr.h
1 #ifndef CPU_P6_MSR_H
2 #define CPU_P6_MSR_H
3
4 /*
5  * Access to machine-specific registers (available on 586 and better only)
6  * Note: the rd* operations modify the parameters directly (without using
7  * pointer indirection), this allows gcc to optimize better
8  */
9
10 #define rdmsr(msr,val1,val2) \
11        __asm__ __volatile__("rdmsr" \
12                             : "=a" (val1), "=d" (val2) \
13                             : "c" (msr))
14
15 #define wrmsr(msr,val1,val2) \
16      __asm__ __volatile__("wrmsr" \
17                           : /* no outputs */ \
18                           : "c" (msr), "a" (val1), "d" (val2))
19
20 #define rdtsc(low,high) \
21      __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high))
22
23 #define rdtscl(low) \
24      __asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx")
25
26 #define rdtscll(val) \
27      __asm__ __volatile__ ("rdtsc" : "=A" (val))
28
29 #define rdpmc(counter,low,high) \
30      __asm__ __volatile__("rdpmc" \
31                           : "=a" (low), "=d" (high) \
32                           : "c" (counter))
33 #endif /* CPU_P6_MSR_H */