From d192d8c017492a740353780d115bd4fc6cec20e9 Mon Sep 17 00:00:00 2001 From: Sylvain Munaut Date: Fri, 1 Jan 2016 13:17:37 +0100 Subject: [PATCH] benchmark: Fix cpuid clobbering Signed-off-by: Sylvain Munaut --- include/gapk/get_cycles.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/gapk/get_cycles.h b/include/gapk/get_cycles.h index ec530fc..9eb7bc3 100644 --- a/include/gapk/get_cycles.h +++ b/include/gapk/get_cycles.h @@ -52,7 +52,7 @@ static inline cycles_t get_cycles() struct timespec ts; #if defined (__x86_64__) || defined(__i386__) - asm volatile ("cpuid"); /* flush pipeline */ + asm volatile ("cpuid" : : : "eax", "ebx", "ecx", "edx" ); /* flush pipeline */ #endif clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts); return ts.tv_nsec; @@ -68,7 +68,7 @@ static inline cycles_t get_cycles() { unsigned low, high; unsigned long long val; - asm volatile ("cpuid"); /* flush pipeline */ + asm volatile ("cpuid" : : : "eax", "ebx", "ecx", "edx" ); /* flush pipeline */ asm volatile ("rdtsc" : "=a" (low), "=d" (high)); val = high; val = (val << 32) | low;