git: 362c6d8dec6d - main - nehemiah: manually assemble xstore(-rng)

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Fri, 22 Oct 2021 23:31:34 UTC
The branch main has been updated by kib:

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

commit 362c6d8dec6dfbedc5717e45769042279a1dd3df
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-10-20 22:42:05 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-10-22 23:31:16 +0000

    nehemiah: manually assemble xstore(-rng)
    
    It seems that clang IAS erronously adds repz prefix which should not be
    there.  Cpu would try to store around %ecx bytes of random, while we
    only expect a word.
    
    PR:     259218
    Reported and tested by:  Dennis Clarke <dclarke@blastwave.org>
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
---
 sys/dev/random/nehemiah.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/random/nehemiah.c b/sys/dev/random/nehemiah.c
index ba0dfb200ba0..3ad18005c935 100644
--- a/sys/dev/random/nehemiah.c
+++ b/sys/dev/random/nehemiah.c
@@ -68,7 +68,7 @@ VIA_RNG_store(void *buf)
 #ifdef __GNUCLIKE_ASM
 	__asm __volatile(
 		"movl	$0,%%edx\n\t"
-		"xstore"
+		".byte 0x0f, 0xa7, 0xc0"
 			: "=a" (retval), "+d" (rate), "+D" (buf)
 			:
 			: "memory"