diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2010-05-03 16:51:35 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2010-05-03 16:51:35 -0700 |
commit | 802e057e6e55fc120cb6d344ca5e6a2690cff3f0 (patch) | |
tree | ca949ddd5a7515796d337b5e2ba5078b25b3db50 /libop/op_hw_specific.h | |
parent | de6b5ecad5b51e38b85975c4f95a9f6e6f13719c (diff) | |
parent | d850f374318831902a1386ec329cb3863b373874 (diff) | |
download | oprofile-802e057e6e55fc120cb6d344ca5e6a2690cff3f0.tar.gz |
merge from open-source master
Change-Id: Iff982a4bec118c01718056fff079460d365968c3
Diffstat (limited to 'libop/op_hw_specific.h')
-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); } |