diff options
author | Bruce Beare <brucex.j.beare@intel.com> | 2010-03-04 10:30:51 -0800 |
---|---|---|
committer | Bruce Beare <brucex.j.beare@intel.com> | 2010-03-04 10:30:51 -0800 |
commit | 751a4435c3ef705b0e31faa14c75b9e2fd859959 (patch) | |
tree | bf347a463c948f0fc91d842f84f04f5e64954155 /libop | |
parent | 56b2728f588644e40195908e68985b9214fcfe8a (diff) | |
download | oprofile-751a4435c3ef705b0e31faa14c75b9e2fd859959.tar.gz |
x86 oprofile enablement
Diffstat (limited to 'libop')
-rw-r--r-- | libop/op_hw_specific.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libop/op_hw_specific.h b/libop/op_hw_specific.h index 35080ad..b1e3b4c 100644 --- a/libop/op_hw_specific.h +++ b/libop/op_hw_specific.h @@ -20,7 +20,8 @@ static inline int cpuid_vendor(char *vnd) char v[12]; } v; unsigned eax; - asm("cpuid" : "=a" (eax), "=b" (v.b), "=c" (v.c), "=d" (v.d) : "0" (0)); + asm volatile( "pushl %%ebx; cpuid; movl %%ebx, %1; popl %%ebx" + : "=a" (eax), "=S" (v.b), "=c" (v.c), "=d" (v.d) : "0" (0)); return !strncmp(v.v, vnd, 12); } @@ -46,7 +47,8 @@ static inline void workaround_nehalem_aaj79(unsigned *ebx) if (!cpuid_vendor("GenuineIntel")) return; - asm("cpuid" : "=a" (v.eax) : "0" (1) : "ecx","ebx","edx"); + asm volatile( "pushl %%ebx; cpuid; movl %%ebx, %1; popl %%ebx" + : "=a" (v.eax) : "0" (1) : "ecx","edx"); model = (v.ext_model << 4) + v.model; if (v.family != 6 || model != 26 || v.stepping > 4) return; @@ -57,7 +59,8 @@ static inline unsigned arch_get_filter(op_cpu cpu_type) { if (cpu_type == CPU_ARCH_PERFMON) { unsigned ebx, eax; - asm("cpuid" : "=a" (eax), "=b" (ebx) : "0" (0xa) : "ecx","edx"); + asm volatile( "pushl %%ebx; cpuid; movl %%ebx, %1; popl %%ebx" + : "=a" (eax), "=S" (ebx) : "0" (0xa) : "ecx","edx"); workaround_nehalem_aaj79(&ebx); return ebx & num_to_mask(eax >> 24); } @@ -68,7 +71,8 @@ static inline int arch_num_counters(op_cpu cpu_type) { if (cpu_type == CPU_ARCH_PERFMON) { unsigned v; - asm("cpuid" : "=a" (v) : "0" (0xa) : "ebx","ecx","edx"); + asm volatile( "pushl %%ebx; cpuid; movl %%eax, %1; popl %%ebx" + : "=a" (v) : "0" (0xa) : "ecx","edx"); return (v >> 8) & 0xff; } return -1; @@ -77,7 +81,8 @@ static inline int arch_num_counters(op_cpu cpu_type) static inline unsigned arch_get_counter_mask(void) { unsigned v; - asm("cpuid" : "=a" (v) : "0" (0xa) : "ebx","ecx","edx"); + asm volatile( "pushl %%ebx; cpuid; movl %%ebx, %1; popl %%ebx" + : "=a" (v) : "0" (0xa) : "ecx","edx"); return num_to_mask((v >> 8) & 0xff); } |