Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Jan 2021 22:08:52 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: a013e285dfd6 - main - x86 tsc: mark %eax as earlyclobber in tscp_get_timecount_low().
Message-ID:  <202101102208.10AM8qOx061865@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=a013e285dfd6b89b1908ca13febb0fdb0a7f3b1f

commit a013e285dfd6b89b1908ca13febb0fdb0a7f3b1f
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-01-10 22:05:49 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-01-10 22:05:49 +0000

    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 ad8108c8a7ea..85924df98312 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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101102208.10AM8qOx061865>