Skip to content

Commit fb44b03

Browse files
committed
The use of cpuid destroys the content of %eax and %edx,
so they must be saved before.
1 parent 2616848 commit fb44b03

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

opal/include/opal/sys/amd64/timer.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ opal_sys_timer_get_cycles(void)
4444
* can afford a small inaccuracy.
4545
*/
4646
__asm__ __volatile__ ("rdtscp\n\t"
47+
"mov %%edx, %0\n\t"
48+
"mov %%eax, %1\n\t"
4749
"cpuid\n\t"
48-
: "=a" (a), "=d" (d)
49-
:: "rbx", "rcx");
50+
: "=r" (a), "=r" (d)
51+
:: "rax", "rbx", "rcx", "rdx");
5052
#endif
5153
return ((opal_timer_t)a) | (((opal_timer_t)d) << 32);
5254
}

0 commit comments

Comments
 (0)