Date: Mon, 9 Aug 2021 17:49:30 GMT From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: e54ae8258d64 - main - amd64: Fix output operand specs for the stmxcsr and vmread intrinsics Message-ID: <202108091749.179HnUdn002954@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e54ae8258d6433ad2f2411dbeaa1fde6b817d5ef commit e54ae8258d6433ad2f2411dbeaa1fde6b817d5ef Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2021-08-09 17:28:08 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2021-08-09 17:28:08 +0000 amd64: Fix output operand specs for the stmxcsr and vmread intrinsics This does not appear to affect code generation, at least with the default toolchain. Noticed because incorrect output specifications lead to false positives from KMSAN, as the instrumentation uses them to update shadow state for output operands. Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31466 --- sys/amd64/amd64/fpu.c | 2 +- sys/amd64/vmm/intel/vmx_cpufunc.h | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c index 20e3dd34405d..d7936b3b1922 100644 --- a/sys/amd64/amd64/fpu.c +++ b/sys/amd64/amd64/fpu.c @@ -79,7 +79,7 @@ __FBSDID("$FreeBSD$"); #define fxrstor(addr) __asm __volatile("fxrstor %0" : : "m" (*(addr))) #define fxsave(addr) __asm __volatile("fxsave %0" : "=m" (*(addr))) #define ldmxcsr(csr) __asm __volatile("ldmxcsr %0" : : "m" (csr)) -#define stmxcsr(addr) __asm __volatile("stmxcsr %0" : : "m" (*(addr))) +#define stmxcsr(addr) __asm __volatile("stmxcsr %0" : "=m" (*(addr))) static __inline void xrstor32(char *addr, uint64_t mask) diff --git a/sys/amd64/vmm/intel/vmx_cpufunc.h b/sys/amd64/vmm/intel/vmx_cpufunc.h index 09d6d25a18e0..05ac56290cb9 100644 --- a/sys/amd64/vmm/intel/vmx_cpufunc.h +++ b/sys/amd64/vmm/intel/vmx_cpufunc.h @@ -137,10 +137,9 @@ vmread(uint64_t r, uint64_t *addr) __asm __volatile("vmread %[r], %[addr];" VMX_SET_ERROR_CODE - : [error] "=r" (error) - : [r] "r" (r), [addr] "m" (*addr) + : [error] "=r" (error), [addr] "=m" (*addr) + : [r] "r" (r) : "memory"); - return (error); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108091749.179HnUdn002954>