The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 1 | /**************************************************************************** |
| 2 | **************************************************************************** |
| 3 | *** |
| 4 | *** This header was automatically generated from a Linux kernel header |
| 5 | *** of the same name, to make information necessary for userspace to |
| 6 | *** call into the kernel available to libc. It contains only constants, |
| 7 | *** structures, and macros generated from the original header, and thus, |
| 8 | *** contains no copyrightable information. |
| 9 | *** |
| 10 | **************************************************************************** |
| 11 | ****************************************************************************/ |
| 12 | #ifndef __ASM_X86_MSR_H_ |
| 13 | #define __ASM_X86_MSR_H_ |
| 14 | |
| 15 | #include <asm/msr-index.h> |
| 16 | |
| 17 | #ifndef __ASSEMBLY__ |
| 18 | #include <linux/types.h> |
| 19 | #endif |
| 20 | |
| 21 | #ifdef __i386__ |
| 22 | |
| 23 | #else |
| 24 | |
| 25 | #ifndef __ASSEMBLY__ |
| 26 | #include <linux/errno.h> |
| 27 | |
| 28 | #define rdmsr(msr,val1,val2) __asm__ __volatile__("rdmsr" : "=a" (val1), "=d" (val2) : "c" (msr)) |
| 29 | |
| 30 | #define rdmsrl(msr,val) do { unsigned long a__,b__; __asm__ __volatile__("rdmsr" : "=a" (a__), "=d" (b__) : "c" (msr)); val = a__ | (b__<<32); } while(0) |
| 31 | |
| 32 | #define wrmsr(msr,val1,val2) __asm__ __volatile__("wrmsr" : : "c" (msr), "a" (val1), "d" (val2)) |
| 33 | |
| 34 | #define wrmsrl(msr,val) wrmsr(msr,(__u32)((__u64)(val)),((__u64)(val))>>32) |
| 35 | |
| 36 | #define rdtsc(low,high) __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high)) |
| 37 | |
| 38 | #define rdtscl(low) __asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx") |
| 39 | |
| 40 | #define rdtscp(low,high,aux) __asm__ __volatile__ (".byte 0x0f,0x01,0xf9" : "=a" (low), "=d" (high), "=c" (aux)) |
| 41 | |
| 42 | #define rdtscll(val) do { unsigned int __a,__d; __asm__ __volatile__("rdtsc" : "=a" (__a), "=d" (__d)); (val) = ((unsigned long)__a) | (((unsigned long)__d)<<32); } while(0) |
| 43 | |
| 44 | #define rdtscpll(val, aux) do { unsigned long __a, __d; __asm__ __volatile__ (".byte 0x0f,0x01,0xf9" : "=a" (__a), "=d" (__d), "=c" (aux)); (val) = (__d << 32) | __a; } while (0) |
| 45 | |
| 46 | #define write_tsc(val1,val2) wrmsr(0x10, val1, val2) |
| 47 | |
| 48 | #define write_rdtscp_aux(val) wrmsr(0xc0000103, val, 0) |
| 49 | |
| 50 | #define rdpmc(counter,low,high) __asm__ __volatile__("rdpmc" : "=a" (low), "=d" (high) : "c" (counter)) |
| 51 | |
| 52 | #endif |
| 53 | #endif |
| 54 | #endif |