From a013e285dfd6b89b1908ca13febb0fdb0a7f3b1f Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Mon, 11 Jan 2021 00:05:49 +0200 Subject: [PATCH] x86 tsc: mark %eax as earlyclobber in tscp_get_timecount_low(). i386 codegen insists on preloading tc_priv into register on i386, and this register cannot be %eax because RDTSCP instruction clobbers it before it is used. Reported and tested by: dim MFC after: 6 days Sponsored by: The FreeBSD Foundation --- sys/x86/x86/tsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c index ad8108c8a7e..85924df9831 100644 --- a/sys/x86/x86/tsc.c +++ b/sys/x86/x86/tsc.c @@ -826,7 +826,7 @@ tscp_get_timecount_low(struct timecounter *tc) uint32_t rv; __asm __volatile("rdtscp; movl %1, %%ecx; shrd %%cl, %%edx, %0" - : "=a" (rv) : "m" (tc->tc_priv) : "ecx", "edx"); + : "=&a" (rv) : "m" (tc->tc_priv) : "ecx", "edx"); return (rv); }